How-to articles, tricks, and solutions about CSS

How to Hide the HTML5 Number Input’s Arrow Buttons

In this tutorial, you will read and learn several methods that are used to hide HTML5 arrow buttons from the number input with the help of CSS properties.

How to Set Sticky Positioning with CSS

In this tutorial, you can find out how to make the “sticky” value of the position property work. Read our snippet to find examples of setting sticky positioning.

How to Create a Glowing Border Around an Input Field

In this snippet, we’re going to demonstrate some examples of creating a glowing border around an input field. For that, you need to use some CSS properties.

How to Make the <div> Element Fill the Remaining Horizontal Space in Flexbox

In this tutorial, you can see how to make the <div> element fill the remaining horizontal space in Flexbox. You can use the flex-grow or flex property.

How to Set a Box-Shadow Only on the Left and Right Sides

In this snippet, you can find some solutions to the problem of adding a box-shadow only on the left and right sides of the element. Use the box-shadow property.

How to Wrap a Long String Without any Whitespace Character

In this snippet, we’ll demonstrate how to wrap a long string without any whitespace character. Use the CSS word-wrap property with the “break-word” value.

How to Make the CSS z-index Property Work

In this snippet, you can find out how to make the CSS z-index property work. See which values of the position property can be used with the z-index property.

How to Limit the Text Length to One Line with CSS

In this snippet, you can find out how to limit the text length to one line by clipping the line, adding an ellipsis or strings. Use the text-overflow property.

How to Make the CSS vertical-align Property Work on the <div> Element

In this snippet, we’ll demonstrate how you can use the CSS vertical-align property with the “middle” value on the HTML <div> element. See some examples.

How to Vertically Align the Text with a Large Font Awesome Icon

In this snippet, we’ll show how you can align the text next to a large Font Awesome icon. For that, use the CSS vertical-align and the line-height properties.

How to Apply CSS Style to the Element Name

In this snippet, we’re going to demonstrate how you can apply CSS styles to the name of the element. For that, you can use attribute selectors. See examples.

How to Right-Align a Flex Item

In this snippet, we’re going to demonstrate how you can right-align a flex item. For that, use the CSS justify-content property with the “space-between” value.

How to Select All Child Elements Recursively in CSS

Read our snippet and find out how to select all child element recursively in CSS. Use a child selector that matches all elements of a specified element.

How to Set a Box-Shadow on One Side of the Element

To set a box shadow on one side of an element, use the box-shadow property. Read and find examples of adding box shadows outside and inside an element.

How to Center an Element with a Fixed Position

Sometimes, you may have difficulties trying to center an element having a position set to “fixed”. If you have faced it, read this snippet and find the solution.

How to Select All Child Elements Except the Last One

Sometimes, you may need to select all the child elements except the last element. For that purpose, you can use the :not and :last-child pseudo- classes.

How to Break Line Without Using <br> Tag in CSS

There are a few ways to break a line without using a <br> tag. For that, we can use the white-space and display properties, as well as pseudo-elements.

How to Apply Multiple Transforms in CSS

There are many ways to apply multiple transforms. We’ll show how to achieve this using multiple values of the transform property and with nested classes.

How to Truncate Multi-Line String with Pure CSS

It's a common problem to truncate a multi-line string. In this snippet, we'll show how to do it with CSS properties. You can also use CSS pseudo-elements.

How to Get a Specific Number of Child Elements With CSS

The :nth-child() pseudo-class selects only the elements that are nth child elements. Read and see examples of getting a specific number of child elements.

How to Select the First and Last <td> in a Row with CSS

In this snippet, we’ll demonstrate how you can select and style individual columns of your table using the :first-child and :last-child pseudo-classes.

How to Wrap Words in a <div> Tag with CSS

If you’ve faced the situation when you need to wrap long words in a <div>, use the white-space property with the “pre-wrap” value and word-wrap property.

How to Center the Text in the HTML Table Row

In this snippet, we’ll demonstrate and explain examples of centering a text in the table row. For that purpose, you can use the CSS text-align property.

How to Match an Empty Input Box with CSS

It is possible to match an empty input box only if the input field is required. In this snippet, we’ll show how to do this using the CSS :valid pseudo-class.

How to Remove Background Image in CSS

The background image is manipulated with the background-image property. But you may need to remove the background image, and we’ll show how it can be done.