How-to articles, tricks, and solutions about CSS

How to Fix CSS Issues on Safari

Browsers serve the web page content differently that is why while using some CSS properties, problems may occur on Safari. Read the snippet and find out a tricky way to solve this problem.

How to Flip Text with CSS

CSS3 allows us to have various effects, including text flipping due to transformation functions. See examples of upside down, horizontal and vertical flipping.

How to Force the Content of the <div> Element to Stay on the Same Line

In this snippet, we’ll demonstrate how to force the content of the HTML <div> element to stay on the same line. Use the overflow and white-space properties.

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 Get the Height of an Element

In this tutorial, you can find out how to get the height of an element using jQuery. Use offsetHeight and clientHeight properties and different jQuery methods.

How to Get the Value of Text Input Field Using JavaScript

Read this tutorial and learn about several methods of getting the value of the input textbox value without wrapping the input element inside a form element.

How to Give a Div Element 100% Height of the Browser Window

Learn How to Give a Div Tag 100% Height of the Browser Window. Let’s see an example and try to discuss each part of the code together with W3docs.

How to Give a Text or Image a Transparent Background Using CSS

Use CSS3 opacity property to make an image or a background transparent. Learn also how to change the opacity while hovering. All with examples.

How to Handle Page Breaks when Printing a Large HTML Table

In this snippet, we’re going to show how to deal with the problem connected with page break when you print a large HTML table. Use some CSS properties.

How to Hide and Show a <div>

Read this tutorial and learn several CSS, JavaScript and jQuery methods of hiding and showing the <div> element. Also, you can find examples and try them.

How to Hide Elements in a Responsive Layout

On this page, we are going to demonstrate how to hide elements in a responsive layout. Read this tutorial to find out how to use CSS and Bootstrap for that purpose.

How to Hide Scrollbars with CSS

Do you know that a bright example of hiding the scroll bar is Facebook chat window? Learn how to hide scrollbars and find solutions! Snippet/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 Horizontally Center a <div> in Another <div>

The <div> tag is used to define parts of a page or a document. Learn How to Horizontally Center a <div> in Another <div> with W3docs tutorial.

How to Horizontally Center a Div with CSS

Sometimes you need to center your <div> horizontally but you don’t know-how. This tutorial is for you. It’s very easy if you follow the steps.

How to Horizontally Center Contents Within a Div

In this tutorial, you’ll see how to horizontally align contents within a <div> element to the center. Use justify-content, text-align, and other CSS properties.

How to Import Google Fonts in CSS File

Google Fonts is a free service of web fonts. In this snippet, you can find how to import Google Fonts in CSS file using the @import rule or the <link> tag.

How to Increase the Space Between Text and Underlining in CSS

Although CSS does not provide many options for the underlines below texts, there are some ways to do this. Read our snippet and find out the solutions.

How to Increase the Space Between the Dots of Dotted Borders

In this snippet, we’ll show how you can overcome the difficulty of increasing the space between the dots of dotted borders. See what properties you can use.

How to Limit Border Length with CSS

You may come across the difficulty of making the border of an element shorter than its parent element. To overcome this, use CSS properties and HTML elements.

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 Maintain the Aspect Ratio with CSS

Very often developers want to create a div element, that can change its width/height as the window width changes. That can be done by maintaining the aspect ratio of the element.

How To Make a <div> Element Extend to the Page Bottom Even Having No Content

In this snippet, we will show how to make a <div> element extend to the page bottom even when it has no content. Read the tutorial and find some examples.

How to Make a <div> Fill the Height of the Remaining Space

In this snippet, you can find some methods of making a <div> fill the remaining space. Use flexbox, absolute positioning, tables, or the calc() function.

How to Make a Child Div Element Wider than the Parent Div

On this page, we’ll demonstrate how you can make a child <div> element wider than the parent <div> element. See what CSS properties you need and try examples.