Blog

CSS

CSS one-liners 🚧

Amazing 🤩!!! CSS one-liners

Ragav Kumar V

Ragav Kumar V

May 16, 2022 — Updated Jun 20, 2022 · 1 min read

To get smooth animated scroll happens when you click on an anchor element with #

e.g. <a href="#intro"> .


_3
html {
_3
scroll-behavior: smooth;
_3
}

HTML5 theming for form elements


_3
input {
_3
accent-color: crimson;
_3
}

::marker is a pseudo element to get cool custom bullet points without using ::before


_3
li::marker {
_3
content: "🤩 ";
_3
}

Nicer read more effect with ... using -webkit-line-clamp.


_7
li::marker {
_7
display: -webkit-box;
_7
-webkit-box-orient: vertical;
_7
/* number of lines show */
_7
-webkit-line-clamp: 3;
_7
overflow: hidden;
_7
}

In the above example, the text will be truncated to 3 lines.

Text gradient using background-clip


_6
p {
_6
background: linear-gradient(to right, #e66465, #9198e5);
_6
background-clip: text;
_6
-webkit-background-clip: text;
_6
color: transparent;
_6
}

@ragavkumarv
swipe to next ➡️