How-to articles, tricks, and solutions about CSS

Add class="active" to active page using PHP

You can add the "active" class to the active page using PHP by comparing the current URL to the URL of the page you want to mark as active.

Colors in JavaScript Console

The console.log() method outputs a message to the web console. Read the tutorial and learn the simplest method of putting a single or multiple styles to it.

How and When to Use !important Rule in CSS

Learn how and why to use the !important rule in your CSS styles. See what cases are recommended and where is the right place to use it.

How Not to Wrap the Contents of <p>, <div>, and <span> Elements

In this snippet, we want to demonstrate how you can make the contents of the <p>, <div>, and <span> elements not to wrap. Use the CSS white-space property.

How to Add a Background-Color for the Text Width Instead of the Entire Element Width

On this page, you will find how to set a background-color for the text width instead of the width of the entire element. Choose the appropriate method and try examples.

How to Add a Blur Filter to the Background Image

Learn How to Apply a Blur Filter to a Background Image with W3docs tutorial. Follow up the steps and create a blurred background image for your website.

How to Add a Border Inside the Table

Read this snippet if you have faced the difficulty of setting a border inside the table. In this tutorial, we suggest two methods of overcoming this problem.

How to Add a Border-Bottom to the Table Row

In this tutorial, we want to demonstrate how you can add a border only to the bottom of the table row. Read and find out what CSS property you need for this.

How to Add a Circle Around a Number in CSS

Adding a circle around a number can be easily done with CSS. This can be done using the border-radius property. Read our snippet and find the solution.

How to Add a Fade out Text Effect with CSS

If you want to use beautiful effects for texts and make your Website more eye-catching, read our snippet, try examples and learn to create fade out text effect.

How to Add a Fixed Width Column with CSS Flexbox

On this page, you will find out how to add a fixed-width column with the help of CSS Flexbox. To achieve this, you need to use the flex or flex-basis property.

How to Add a Frame Around an Image

How to add border as a frame for images. Also add image borders to images. See also Circle and Round frames. All with examples.

How to Add a Glass Background Effect to the Text

If you want to make your website eye-catching and creative read this snippet and learn to create a glass background effect for your text step by step.

How to add a print button to a web page

To add a print button to a web page using PHP, you can use the following steps:

How to Add a Vertical Line in HTML

In this snippet, we’ll show how to add a vertical line on the left and right sides, as well as how to center it and how to add a vertical line before a text.

How to Add a Vertical Text with CSS Cross-Browser

If you have faced the problem of drawing a vertical text, you can use the transform property. Find out how to use this property to create a vertical text with CSS Cross-Browser.

How to Add Advanced Hover Effects to an Image with Pure CSS

Hover effects can create powerful effects when applied to the images. Learn how to make advanced image hover effects with CSS and see examples!

How to Add an Animated Text Over an Image on Hover With CSS3

Know how to put an animated text over a faded image on hover using only CSS3. For that purpose, use the transition and the opacity properties. See examples!

How to Add an Onclick Effect with HTML and CSS

In this snippet, we’ll demonstrate how to add an onclick event in CSS. The best way of creating an onclick effect is using the well-known checkbox hack.

How to Add and Use CSS Comments

A CSS comment is used to give explanatory information to the code or to prevent the browser from trying to interpret particular parts of the style sheet.

How to Add Background Image with CSS

To add background image to your HTML document you should use CSS styles.

How to Add Border Inside a Div

If you need to place a border inside a <div> element, you are in the right place. In this snippet, you can find out how to do it using some CSS properties.

How to Add Border to Image in CSS

Learn about how to add border to an image, how to add styling to it and how to specify each corner and have circle borders. Practice all with examples.

How to Add Both a Background Image and CSS3 Gradient to the Same Element

If you want to make your website more attractive, read this snippet and learn how to add both a background-image and CSS3 gradient to the same element.

How to Add Colors to Bootstrap Icons with CSS

Using icons is great for every website. If you face the difficulty of adding color to Bootstrap icons, add the CSS color property. Change also the font-size.

1 2 3 4 5