brancher
CSS Layout - Horizontal & Vertical Align

CSS Layout - Horizontal & Vertical Align

CSS Layout - Horizontal & Vertical Align

CSS Layout - Horizontal & Vertical Align

▲ ▼ ◀ ►Center elementshorizontally and vertically Center Align Elements To horizontally center a block element (like <div>), use margin: auto; Setting the width of the element will prevent it from stretching out to the edges of its container. The element will then take up the specified width, and the remaining space will be split equally between the two margins: This div element is centered. Example .center { margin: auto; width: 50%; border: 3px solid green; padding: 10px; } Try it Yourself » ...

favicon
w3schools.com
CSS Pseudo-classes

CSS Pseudo-classes

What are Pseudo-classes? A pseudo-class is used to define a special state of an element. For example, it can be used to: Style an element when a user mouses over it Style visited and unvisited links differently Style an element when it gets focus Syntax The syntax of pseudo-classes: selector:pseudo-class { property: value;} Anchor Pseudo-classes Links can be displayed in different ways: Example a:link { color: #FF0000;}a:visited { color: #00FF00;} a:hover { color: #FF00FF;}a:active { color: #00...

favicon
w3schools.com
CSS Image Opacity / Transparency

CSS Image Opacity / Transparency

The opacity property specifies the opacity/transparency of an element. Transparent Image The opacity property can take a value from 0.0 - 1.0. The lower value, the more transparent: opacity 0.2 opacity 0.5 opacity 1(default) Transparent Hover Effect The opacity property is often used together with the :hover selector to change the opacity on mouse-over: Example explained The first CSS block is similar to the code in Example 1. In addition, we have added what should happen when a user hovers ove...

favicon
w3schools.com
Tryit Editor v3.6

Tryit Editor v3.6

<!DOCTYPE html><html><head><style>q:lang(no) { quotes: "~" "~";}</style></head><body>​<p>Some text <q lang="no">A quote in a paragraph</q> Some text.</p><p>In this example, :lang defines the quotation marks for q elements with lang="no":</p><p><b>Note:</b> IE8 supports the :lang pseudo class only if a !DOCTYPE is specified.</p>​</body></html>​

favicon
w3schools.com
Tryit Editor v3.6

Tryit Editor v3.6

<!DOCTYPE html><html><head><style>p i:first-child { color: blue;} </style></head><body>​<p>I am a <i>strong</i> person. I am a <i>strong</i> person.</p><p>I am a <i>strong</i> person. I am a <i>strong</i> person.</p><p><b>Note:</b> For :first-child to work in IE8 and earlier, a DOCTYPE must be declared.</p>​</body></html>​

favicon
w3schools.com
Tryit Editor v3.6

Tryit Editor v3.6

<!DOCTYPE html><html><head><style>p:first-child { color: blue;} </style></head><body>​<p>This is some text.</p><p>This is some text.</p><p><b>Note:</b> For :first-child to work in IE8 and earlier, a DOCTYPE must be declared.</p>​</body></html>​

favicon
w3schools.com
CSS Counters

CSS Counters

CSS counters are "variables" maintained by CSS whose values can be incremented by CSS rules (to track how many times they are used). Counters let you adjust the appearance of content based on its placement in the document. Automatic Numbering With Counters CSS counters are like "variables". The variable values can be incremented by CSS rules (which will track how many times they are used). To work with CSS counters we will use the following properties: counter-reset - Creates or resets a counte...

favicon
w3schools.com
CSS Website Layout

CSS Website Layout

Website Layout A website is often divided into headers, menus, content and a footer: There are tons of different layout designs to choose from. However, the structure above, is one of the most common, and we will take a closer look at it in this tutorial. Header A header is usually located at the top of the website (or right below a top navigation menu). It often contains a logo or the website name: Example .header { background-color: #F1F1F1; text-align: center; padding: 20px;} Result Try it Y...

favicon
w3schools.com
Tryit Editor v3.6

Tryit Editor v3.6

<!DOCTYPE html><html><head><style>body { counter-reset: section;}​h2::before { counter-increment: section; content: "Section " counter(section) ": ";}</style></head><body>​<h1>Using CSS Counters:</h1><h2>HTML Tutorial</h2><h2>CSS Tutorial</h2><h2>JavaScript Tutorial</h2>​<p><b>Note:</b> IE8 supports these properties only if a !DOCTYPE is specified.</p>​</body></html>​

favicon
w3schools.com
border