7 CSS Properties you didn't know about !

7 CSS Properties you didn't know about !

Introduction 🚀

CSS can be annoying to deal with because sometimes HTML Elements don't just go in the flow that you want them to go 😓. In This Article, we will talk about 7 unknown useful properties I bet you do not know ! ⚡

  1. Webkit input placeholder
  2. Caret color
  3. The ":not" selector
  4. Outline property
  5. Webkit scrollbar
  6. Text overflow ellipsis
  7. Webkit outer/inner spin button

Webkit-input-placeholder

The -webkit-input-placeholder selector allows to modify the input placeholder style.

Caret color

The caret-color property modify the cursor color inside inputs or textareas.

The ":not" selector

The :not selector matches every elements that is NOT specified in the selector.

Outline property

The outline property removes the input status line when focusing on it.

Webkit-scrollbar

The -webkit-scrollbar gives you ability to control the scrollbar that exists on elements. For example, you can hide it as shown in the example below.

Text overflow ellipsis

Have you ever wondered how to make long text shows some words followed by 3 dots depending on the width of the container ? Yes, you can do that with the ellipsis value of text-overflow property.

Webkit outer/inner spin button

The -webkit-outer-spin-button and -webkit-inner-spin-button allows you to hide both arrows that exists on the number input for incrementing and decrementing.


Conclusion ✅

If you found that those properties are valuable and useful, start using them in your next projects and share the post. 🙏♻

Frequently Asked Questions

What are some lesser known but useful CSS properties?

Some underused CSS properties include caret-color for styling the text cursor, text-overflow: ellipsis for truncating overflowing text, the outline property for accessible focus rings, and the ::-webkit-scrollbar and ::-webkit-input-placeholder pseudo-elements for custom styling.

What does the CSS caret-color property do?

The caret-color property sets the color of the blinking text input cursor, known as the caret, inside editable fields so you can match it to your design.

How do you add an ellipsis to overflowing text in CSS?

Use text-overflow: ellipsis together with white-space: nowrap and overflow: hidden. This truncates text that does not fit its container and adds a trailing set of dots.

What is the CSS :not() selector used for?

The :not() selector styles every element except the ones matching the selector inside it. For example, li:not(:last-child) targets all list items except the last one.

Can you style a scrollbar with CSS?

Yes. In Chromium and WebKit browsers you can style the scrollbar with the ::-webkit-scrollbar pseudo-element and its parts such as ::-webkit-scrollbar-thumb and ::-webkit-scrollbar-track.