Replies

This profile is from a federated server and may be incomplete. Browse more on the original instance.

css, to CSS
@css@front-end.social avatar

Using modern CSS features to create a custom range slider with a tooltip. There is no JS to update the values, it's pure CSS with minimal HTML 😎

Powered by Scroll Driven animation, Anchor positioning, @​property and more! 🤩

Demo: https://codepen.io/t_afif/full/JjqNEbZ via :codepen: @codepen

Online Version: https://css-tip.com/range-slider-tooltip/

It's Chrome only for the tooltip but the range slider works fine in all the browsers.

Showing two range slider with a tooltip containing the selected values. From the linked demo.

css,
@css@front-end.social avatar

@simevidas it's a demo to illustrate the input, you can easily add any text inside the label as a label. It's irrelevant to the demo so I didn't do it.

css,
@css@front-end.social avatar

The previous range slider was good but not good enough to me. Let's upgrade it with some motion!

Now the tooltip will follow your movement to get a more realistic effect. Still 100% CSS magic. No JS! 😎

Demo: https://codepen.io/t_afif/full/MWdmZPL via :codepen: @codepen

#CSS #HTML

Showing two range sliders with tooltip. Overview from the linked demo

peterreeves, to CSS
@peterreeves@mstdn.social avatar

I don't understand why CSS is so verbose sometimes. Why couldn't I just do:
color: --brand-red;
???
Why do I need to surround every use of it with var(...)? Wasn't the double-dash prefix was specifically chosen to not clash with any existing or future properties?

It's always so frustrating writing CSS. Especially compared to all the structure, abstractions, and terseness that programming languages offer.

#CSS #WevDev

css,
@css@front-end.social avatar

@peterreeves You are considering a very basic usage of CSS variables and custom properties.

As you said, the double slash is there for the custom property part but the var() is for something different.

When you stumble upon complex cases, you will understand why.

Here is one example: https://codepen.io/t_afif/pen/mdYWjMd/968d5b837195c328ee757d6716791054

css, (edited )
@css@front-end.social avatar

@peterreeves not sure what you mean by shadowing but I am allowed to "name" a keyframes using --var and at the same time define a "custom property" --var. Two different things.

Your example is equivalent but with a different naming for the keyframes.

css,
@css@front-end.social avatar

@peterreeves It's far from being an edge case.

In CSS, naming stuff obey to the "custom-indent" syntax which is something very old and used in a lot of places https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident

The browser need to know how to parse a "name" and a "variable".

Same logic with calculation. If we consider simple use cases, writing height: 3 * 10px should be valid but no, we need calc(3 * 10px) for the browser to know it's a calculation

css,
@css@front-end.social avatar

@peterreeves and naming stuff using "dashed indent" (https://www.w3.org/TR/css-values-4/#dashed-idents) will be more and more used in the future for author-related stuff

One example is the anchor-name which is defined to work with "dashed indent" and not "custom indent" (unlike animation-name): https://developer.chrome.com/blog/anchor-positioning-api

The usage of var() in such situations make sense.

css,
@css@front-end.social avatar

@peterreeves

Why in JS we need to place a string between quotes? it's much better to be able to write var x = I am a string;

You probably don't know all the mechanism of CSS but the introduction of var(), calc(), etc is a not random decision to make things look complex. There is a whole community debating, discussing before defining such features.

css,
@css@front-end.social avatar

@peterreeves

> How on earth could something like left: 3 * 10px; be ambiguous?

the same ambiguity between
let x = I am a string;
let x = "I am a string";

as a side note, CSS is not an obscure language defined by some person in a dark room.

People do give their opinion on all the features before they are defined and Speced. You can also do the same.

Everything is public from the idea to the implementation.

tixie, to random
@tixie@guerilla.studio avatar

[edit] Fixed thanks to @css : https://front-end.social/@css/112546423845308678

I've placed a disc made with a radial-gradient on the top of its container…but it's not actually at the top, there are a few pixels, any idea where it's come from?
I may be stupid but It drives me crazy 😒

Codepen here: https://codepen.io/Tixie/pen/yLWMxKw?editors=1100

image/png

css,
@css@front-end.social avatar

@tixie the color stop need to be "72%" because the default reference is "farthest-corner" so you are getting 50% of the diagonal.

To make it easy use "50% 50%" instead of "circle" then use "100%" in the color stop percentage

css,
@css@front-end.social avatar

@tixie You also have to update the position

Here is a demo: https://codepen.io/t_afif/pen/MWdpqVR

css, to CSS
@css@front-end.social avatar

🛑 STOP Scrolling!

It's time to learn something new in CSS. You are one click away from getting a cool demo. What are you waiting for?

👉 https://random.css-tip.com 👈

css, (edited )
@css@front-end.social avatar

@jaandrle
I prefer to manually share them because they don't have the same format and a random feature may break stuff.

css, to CSS
@css@front-end.social avatar

🎮 New CSS Game!

What about a CSS game that you can play with your keyboard? No, it's not a joke but a reality!

Play "Super CSS Mario", the first ever CSS-Only game playable using your keyboard. Have fun! 🤩

✅ 0% JavaScript
✅ 100% CSS Magic

Demo: https://codepen.io/t_afif/full/OJYbVWP via :codepen: @codepen

Record yourself and show me your best attempt (No screenshots & no cheating 😈)

It's a Chrome (or Edge) only. I repeat, it's a Chrome-only experience.

#CSS #HTML #game

Showing a demo of the CSS-only game linked in the post. A cool Mario game where you can collect gold coins using Keyboard.

css,
@css@front-end.social avatar

Ready for "Super CSS Mario II"? This time it's more challenging because you have to avoid some enemies 😬

0% JavaScript, 100% CSS magic & 100% addictive!

Demo: https://codepen.io/t_afif/full/JjqEdJv via :codepen: @codepen

Show me your best attempt 👇

#CSS #HTML

css,
@css@front-end.social avatar

@kizu it looks like you are using the mouse cheat, right? 😜

jkjustjoshing, to CSS
@jkjustjoshing@fosstodon.org avatar

Is there ever a time when this

width: 100%;
max-width: 480px;

behaves differently than this?

width: 480px;
max-width: 100%;

#css #html #WebDesign #webdev

css,
@css@front-end.social avatar

@collinsworth @jkjustjoshing

I would say it depends on the percentage reference. In some cases, we cannot resolve the percentage so the 100% will fall to auto and you can see a different behavior.

Ex: https://codepen.io/t_afif/pen/eYazBrQ/80d9ae23ca3a84872ba15ab53e739fbb

danrot, to webdev
@danrot@mastodon.social avatar

I am sincerely wondering how hard it is to style a checkbox using . I'd be happy with just aligning them with a label, but this already seems to be asking for a lot. And most answers I find online are already outdated...

But hey, if you know more than I do let me know 🙂

css,
@css@front-end.social avatar

@danrot I wrote a small tutorial on how to create simple and also more complex design for checkbox

https://verpex.com/blog/website-tips/how-to-style-checkbox-and-radio-buttons-using-css

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • InstantRegret
  • mdbf
  • osvaldo12
  • magazineikmin
  • GTA5RPClips
  • rosin
  • thenastyranch
  • Youngstown
  • cubers
  • slotface
  • khanakhh
  • kavyap
  • DreamBathrooms
  • anitta
  • Durango
  • everett
  • ethstaker
  • cisconetworking
  • Leos
  • provamag3
  • modclub
  • ngwrru68w68
  • tacticalgear
  • tester
  • megavids
  • normalnudes
  • lostlight
  • All magazines