W3.CSS complete learning guide

W3.CSS Panel10 / 19 · Keep scrolling
Framework & classes

What is a Web Framework?

Understand the concept

W3.CSS ready-made CSS classes ka toolkit hai. Classes HTML mein lagti hain aur stylesheet unka design provide karti hai.

Keep this in mind

w3-color jaise names families ko represent karte hain; actual classes w3-blue ya w3-red hoti hain.

01 · Understand02 · See every example03 · Try it yourself
LEARN BY SEEING

Change the class. See the design change.

Interactive

W3.CSS ki stylesheet mein styles pehle se likhe hain. HTML ke class attribute mein naam badlein aur output compare karein.

Your W3.CSS example
<div class="w3-panel w3-padding w3-blue">
  Your W3.CSS example
</div>

The stylesheet is already included in these examples. Your own page needs the W3.CSS stylesheet link in its head.

Detailed explanation & examples

Compare each visual with the code directly below it.

What is a Web Framework?

Imagine a framework as a powerful toolkit for web developers. It's like a pre-built LEGO set that gives you all the essential pieces to construct a website quickly and efficiently.

Key Benefits:

  • ✓ Saves development time
  • ✓ Ensures consistent design
  • ✓ Provides cross-browser compatibility
Example
<ul class="w3-ul">
<li>✓ Saves development time</li>
<li>✓ Ensures consistent design</li>
<li>✓ Provides cross-browser compatibility</li>
</ul>

Try a complete example

Try this lesson
index.html
<div class="w3-container w3-blue w3-padding"><h1>Build with classes</h1><p>A ready-made toolkit for your design.</p></div>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERDiscover W3.CSS: Your Design Superpower
Framework & classes

Discover W3.CSS: Your Design Superpower

Understand the concept

W3.CSS ready-made CSS classes ka toolkit hai. Classes HTML mein lagti hain aur stylesheet unka design provide karti hai.

Keep this in mind

w3-color jaise names families ko represent karte hain; actual classes w3-blue ya w3-red hoti hain.

01 · Understand02 · See every example03 · Try it yourself

Detailed explanation & examples

Compare each visual with the code directly below it.

Discover W3.CSS: Your Design Superpower

Mobile-First

Responsive design that looks great on all devices, from smartphones to desktops.

Lightweight

Super fast and efficient, with minimal overhead and no jQuery dependencies.

Easy to Learn

Simple, intuitive classes that make web design accessible to everyone.

Try a complete example

Try this lesson
index.html
<div class="w3-row-padding"><div class="w3-third"><div class="w3-panel w3-pale-blue">Mobile-first</div></div><div class="w3-third"><div class="w3-panel w3-pale-green">Lightweight</div></div><div class="w3-third"><div class="w3-panel w3-pale-yellow">Easy to learn</div></div></div>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERHow to Use W3.CSS
Framework & classes

How to Use W3.CSS

Understand the concept

W3.CSS ready-made CSS classes ka toolkit hai. Classes HTML mein lagti hain aur stylesheet unka design provide karti hai.

Keep this in mind

w3-color jaise names families ko represent karte hain; actual classes w3-blue ya w3-red hoti hain.

01 · Understand02 · See every example03 · Try it yourself
LEARN BY SEEING

Change the class. See the design change.

Interactive

W3.CSS ki stylesheet mein styles pehle se likhe hain. HTML ke class attribute mein naam badlein aur output compare karein.

Your W3.CSS example
<div class="w3-panel w3-padding w3-blue">
  Your W3.CSS example
</div>

The stylesheet is already included in these examples. Your own page needs the W3.CSS stylesheet link in its head.

Detailed explanation & examples

Compare each visual with the code directly below it.

How to Use W3.CSS

Method 1: Quick CDN Integration

Example
<link rel="stylesheet" href=
"https://www.w3schools.com/w3css/4/w3.css">

Simply paste this link in your HTML's <head> section. Instant styling magic!

Example
<p class="w3-text-dark-grey">Simply paste this link in your HTML's &lt;head&gt; section. Instant styling magic!</p>

Method 2: Download & Custom Setup

  1. Download w3.css from official W3Schools website
  2. Save in your project's CSS directory
  3. Link in your HTML with a local path
Handwritten PDF · pages 4

Your own styles with W3.CSS

Framework ke baad apni stylesheet link kar sakte hain. Component colours/classes ko samajhkar custom style likhein; kuch utility classes !important use karti hain.

Example
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="lesson.css">

<h2 class="lesson-title">My heading</h2>
Example
/* lesson.css */
.lesson-title { font-family: Georgia, serif; font-size: 26px; }

Use w3-large/w3-xlarge for the framework size utilities, or use your own class when defining a custom heading.

Try a complete example

Try this lesson
index.html
<!-- The compiler includes W3.CSS for this course. In your own HTML head use:
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
-->
<div class="w3-panel w3-blue"><h1>W3.CSS is ready</h1></div>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Classes: Colors and Hover Effects
Framework & classes

W3.CSS Classes: Colors and Hover Effects

Understand the concept

Example mein di gayi class ko HTML element ke class attribute mein likhein. Phir visual reference aur apna output compare karein.

Keep this in mind

W3.CSS sirf styling deta hai; collapse ya close jaise behaviour ke liye JavaScript bhi chahiye ho sakti hai.

01 · Understand02 · See every example03 · Try it yourself
LEARN BY SEEING

Change the class. See the design change.

Interactive

W3.CSS ki stylesheet mein styles pehle se likhe hain. HTML ke class attribute mein naam badlein aur output compare karein.

Your W3.CSS example
<div class="w3-panel w3-padding w3-blue">
  Your W3.CSS example
</div>

The stylesheet is already included in these examples. Your own page needs the W3.CSS stylesheet link in its head.

Detailed explanation & examples

Compare each visual with the code directly below it.

W3.CSS Classes: Colors and Hover Effects

W3.CSS provides simple and effective classes for applying colors and hover effects. Let's explore the main classes:

1. w3-color

The w3-color class sets the background color of an element.

This is a background example with w3-blue.
Example
<div class="w3-panel w3-blue w3-padding w3-round">This is a background example with <code>w3-blue</code>.</div>

2. w3-text-color

The w3-text-color class changes the text color of an element.

This text is red using w3-text-red.

Example
<p class="w3-text-red">This text is red using <code>w3-text-red</code>.</p>

3. w3-hover-color

The w3-hover-color class applies a background color when the element is hovered over.

Example
<button class="w3-button w3-light-grey w3-hover-blue">Hover me for a blue background</button>

4. w3-hover-text-color

The w3-hover-text-color class changes the text color on hover.

Hover over this text to turn it green.

Example
<p class="w3-hover-text-green">Hover over this text to turn it green.</p>

Try a complete example

Try this lesson
index.html
<div class="w3-panel w3-blue">Blue background</div><p class="w3-text-red">Red text</p><button class="w3-button w3-light-grey w3-hover-green">Hover me</button>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Border Classes
Framework & classes

W3.CSS Border Classes

Understand the concept

w3-border se border, w3-border-blue se colour aur w3-leftbar jaise classes se thick side border lagta hai.

Keep this in mind

w3-border-color ek family ka naam hai; actual class w3-border-red ya w3-border-blue hoti hai.

01 · Understand02 · See every example03 · Try it yourself
LEARN BY SEEING

Change the class. See the design change.

Interactive

W3.CSS ki stylesheet mein styles pehle se likhe hain. HTML ke class attribute mein naam badlein aur output compare karein.

Your W3.CSS example
<div class="w3-panel w3-padding w3-border w3-border-blue">
  Your W3.CSS example
</div>

The stylesheet is already included in these examples. Your own page needs the W3.CSS stylesheet link in its head.

Detailed explanation & examples

Compare each visual with the code directly below it.

W3.CSS Border Classes

W3.CSS provides an extensive range of classes to manage borders efficiently. Here are the key classes with examples:

1. w3-border

The w3-border class applies a default border around an element.

This is an example of w3-border.

2. w3-border-left, w3-border-right, w3-border-top, w3-border-bottom

These classes apply borders to specific sides of an element.

Left border with w3-border-left.
Right border with w3-border-right.
Top border with w3-border-top.
Bottom border with w3-border-bottom.

3. w3-border-color

Use w3-border-color classes to set the border color.

Red border using w3-border-red.
Blue border using w3-border-blue.

4. w3-hover-border-color

The w3-hover-border-color class changes the border color on hover.

Hover me to see a green border.

5. w3-topbar and w3-bottombar

These classes create a top or bottom border with increased thickness.

Topbar with w3-topbar.
Bottombar with w3-bottombar.
Handwritten PDF · pages 3

Thick bars on every side

w3-border thin border deta hai. w3-topbar, w3-rightbar, w3-bottombar aur w3-leftbar thicker edges banate hain.

w3-topbar
Example
<div class="w3-panel w3-pale-blue w3-border-blue w3-topbar">Border example</div>
w3-rightbar
Example
<div class="w3-panel w3-pale-blue w3-border-blue w3-rightbar">Border example</div>
w3-bottombar
Example
<div class="w3-panel w3-pale-blue w3-border-blue w3-bottombar">Border example</div>
w3-leftbar
Example
<div class="w3-panel w3-pale-blue w3-border-blue w3-leftbar">Border example</div>

Try a complete example

Try this lesson
index.html
<div class="w3-panel w3-border w3-border-blue w3-round">Blue border</div><div class="w3-panel w3-leftbar w3-border-green w3-pale-green">Left border</div><div class="w3-panel w3-border w3-hover-border-red">Hover border</div>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Font Size Classes
Framework & classes

W3.CSS Font Size Classes

Understand the concept

w3-small, w3-large, w3-xlarge aur w3-jumbo text ka size badalte hain. Ek hi text par classes compare karein.

Keep this in mind

Font size text ki height badalta hai; w3-wide letters ke beech spacing badhata hai.

01 · Understand02 · See every example03 · Try it yourself
LEARN BY SEEING

Change the class. See the design change.

Interactive

W3.CSS ki stylesheet mein styles pehle se likhe hain. HTML ke class attribute mein naam badlein aur output compare karein.

Your W3.CSS example
<div class="w3-panel w3-padding w3-small">
  Your W3.CSS example
</div>

The stylesheet is already included in these examples. Your own page needs the W3.CSS stylesheet link in its head.

Detailed explanation & examples

Compare each visual with the code directly below it.

W3.CSS Font Size Classes

W3.CSS provides font size classes to adjust text sizes responsively. Below is a table that lists these classes with descriptions and examples:

Class NameDescription
w3-tinyApplies a very small font size.
w3-smallApplies a small font size.
w3-largeApplies a large font size.
w3-xlargeApplies an extra-large font size.
w3-xxlargeApplies a double-extra-large font size.
w3-xxxlargeApplies a triple-extra-large font size.
w3-jumboApplies a jumbo font size for headings or emphasis.
Example
<table class="w3-table w3-striped w3-bordered w3-hoverable">
<thead>
<tr class="w3-light-green">
<th>Class Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>w3-tiny</code></td>
<td>Applies a very small font size.</td>
</tr>
<tr>
<td><code>w3-small</code></td>
<td>Applies a small font size.</td>
</tr>
<tr>
<td><code>w3-large</code></td>
<td>Applies a large font size.</td>
</tr>
<tr>
<td><code>w3-xlarge</code></td>
<td>Applies an extra-large font size.</td>
</tr>
<tr>
<td><code>w3-xxlarge</code></td>
<td>Applies a double-extra-large font size.</td>
</tr>
<tr>
<td><code>w3-xxxlarge</code></td>
<td>Applies a triple-extra-large font size.</td>
</tr>
<tr>
<td><code>w3-jumbo</code></td>
<td>Applies a jumbo font size for headings or emphasis.</td>
</tr>
</tbody>
</table>

Try a complete example

Try this lesson
index.html
<p class="w3-small">Small</p><p class="w3-large">Large</p><p class="w3-xxlarge">XX Large</p><p class="w3-jumbo">Jumbo</p>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Text Classes
Framework & classes

W3.CSS Text Classes

Understand the concept

w3-left-align, w3-center aur w3-right-align text align karte hain; w3-wide letter spacing aur w3-opacity transparency badalti hai.

Keep this in mind

w3-center text alignment hai; w3-display-middle positioning class hai.

01 · Understand02 · See every example03 · Try it yourself
LEARN BY SEEING

Change the class. See the design change.

Interactive

W3.CSS ki stylesheet mein styles pehle se likhe hain. HTML ke class attribute mein naam badlein aur output compare karein.

Your W3.CSS example
<div class="w3-panel w3-padding w3-left-align">
  Your W3.CSS example
</div>

The stylesheet is already included in these examples. Your own page needs the W3.CSS stylesheet link in its head.

Detailed explanation & examples

Compare each visual with the code directly below it.

W3.CSS Text Classes

W3.CSS offers a variety of text-related classes for alignment, spacing, and styles. The table below explains these classes:

Class NameDescriptionExample
w3-leftAligns text to the left.This text is left-aligned.
w3-centerCenters the text.This text is centered.
w3-rightAligns text to the right.This text is right-aligned.
w3-wideAdds letter-spacing to text.This text is wide-spaced.
w3-opacityApplies transparency to text.This text is semi-transparent.
Example
<table class="w3-table w3-striped w3-bordered w3-hoverable">
<thead>
<tr class="w3-light-blue">
<th>Class Name</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>w3-left</code></td>
<td>Aligns text to the left.</td>
<td class="w3-left">This text is left-aligned.</td>
</tr>
<tr>
<td><code>w3-center</code></td>
<td>Centers the text.</td>
<td class="w3-center">This text is centered.</td>
</tr>
<tr>
<td><code>w3-right</code></td>
<td>Aligns text to the right.</td>
<td class="w3-right">This text is right-aligned.</td>
</tr>
<tr>
<td><code>w3-wide</code></td>
<td>Adds letter-spacing to text.</td>
<td class="w3-wide">This text is wide-spaced.</td>
</tr>
<tr>
<td><code>w3-opacity</code></td>
<td>Applies transparency to text.</td>
<td class="w3-opacity" style="opacity: 0.5;">This text is semi-transparent.</td>
</tr>
</tbody>
</table>

Try a complete example

Try this lesson
index.html
<p class="w3-left-align">Left</p><p class="w3-center w3-wide">Centred and spaced</p><p class="w3-right-align w3-text-blue">Right</p>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Table Classes
Framework & classes

W3.CSS Table Classes

Understand the concept

w3-table basic table, w3-striped alternate rows, w3-bordered row borders aur w3-hoverable row hover effect deta hai.

Keep this in mind

w3-table-all bordered/striped presentation combine karta hai. Horizontal scrolling ke liye w3-responsive wrapper use karein.

01 · Understand02 · See every example03 · Try it yourself

Detailed explanation & examples

Compare each visual with the code directly below it.

W3.CSS Table Classes

W3.CSS provides various table classes to style your tables efficiently. Below is a table that explains and demonstrates these classes:

Class NameDescriptionExample
w3-tableApplies default table styling with full-width.
Sample Table
Example
<table class="w3-table"><tr><td>Sample Table</td></tr></table>
w3-stripedAlternates background colors for rows.
Row 1
Row 2
Example
<table class="w3-table w3-striped"><tr><td>Row 1</td></tr><tr><td>Row 2</td></tr></table>
w3-borderedAdds borders to the table and cells.
Cell 1
Example
<table class="w3-table w3-bordered"><tr><td>Cell 1</td></tr></table>
w3-borderAdds a single border around the table.
Cell 1
Example
<table class="w3-table w3-border"><tr><td>Cell 1</td></tr></table>
w3-hoverableHighlights rows on hover.
Hover Row
Example
<table class="w3-table w3-hoverable"><tr><td>Hover Row</td></tr></table>
w3-centeredCenters the table content.
Centered
Example
<table class="w3-table w3-centered"><tr><td>Centered</td></tr></table>
Example
<table class="w3-table w3-striped w3-bordered w3-hoverable">
<thead>
<tr class="w3-light-blue">
<th>Class Name</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>w3-table</code></td>
<td>Applies default table styling with full-width.</td>
<td><table class="w3-table"><tr><td>Sample Table</td></tr></table></td>
</tr>
<tr>
<td><code>w3-striped</code></td>
<td>Alternates background colors for rows.</td>
<td><table class="w3-table w3-striped"><tr><td>Row 1</td></tr><tr><td>Row 2</td></tr></table></td>
</tr>
<tr>
<td><code>w3-bordered</code></td>
<td>Adds borders to the table and cells.</td>
<td><table class="w3-table w3-bordered"><tr><td>Cell 1</td></tr></table></td>
</tr>
<tr>
<td><code>w3-border</code></td>
<td>Adds a single border around the table.</td>
<td><table class="w3-table w3-border"><tr><td>Cell 1</td></tr></table></td>
</tr>
<tr>
<td><code>w3-hoverable</code></td>
<td>Highlights rows on hover.</td>
<td><table class="w3-table w3-hoverable"><tr><td>Hover Row</td></tr></table></td>
</tr>
<tr>
<td><code>w3-centered</code></td>
<td>Centers the table content.</td>
<td><table class="w3-table w3-centered"><tr><td>Centered</td></tr></table></td>
</tr>
</tbody>
</table>

Try a complete example

Try this lesson
index.html
<div class="w3-responsive"><table class="w3-table-all w3-hoverable"><tr class="w3-blue"><th>Topic</th><th>Progress</th></tr><tr><td>Colours</td><td>Ready</td></tr><tr><td>Tables</td><td>Practising</td></tr></table></div>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Container
Framework & classes

W3.CSS Container

Understand the concept

w3-container consistent left aur right padding deta hai. Class ko heading ya paragraph ke wrapper par lagayein.

Keep this in mind

w3-panel mein horizontal padding ke saath top/bottom margin bhi hota hai.

01 · Understand02 · See every example03 · Try it yourself

Detailed explanation & examples

Compare each visual with the code directly below it.

W3.CSS Container

The w3-container class provides consistent padding and spacing, making it ideal for sectioning content on a webpage.

This is a W3.CSS container. It ensures uniform padding and spacing.

Try a complete example

Try this lesson
index.html
<div class="w3-container w3-blue"><h1>Container</h1><p>Consistent horizontal padding.</p></div>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Panel
Framework & classes

W3.CSS Panel

Understand the concept

w3-panel horizontal padding aur vertical margins ke saath content block banata hai. Colour ya border alag classes se add karein.

Keep this in mind

Panel par border automatically nahi aata; w3-border explicitly lagayein.

01 · Understand02 · See every example03 · Try it yourself

Detailed explanation & examples

Compare each visual with the code directly below it.

W3.CSS Panel

The w3-panel class adds horizontal padding and vertical margins. Add w3-border when you want a border.

This is a W3.CSS panel. It adds borders and spacing to the content.

Example
<div class="w3-panel w3-border w3-light-grey example-box">
<p>This is a W3.CSS panel. It adds borders and spacing to the content.</p>
</div>

Try a complete example

Try this lesson
index.html
<div class="w3-panel w3-pale-blue"><p>Panel with padding and vertical margins.</p></div><div class="w3-panel w3-border w3-border-blue"><p>Add a border explicitly.</p></div>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Rounded Panel
Framework & classes

W3.CSS Rounded Panel

Understand the concept

w3-round, w3-round-large aur w3-round-xlarge panel ke corners round karte hain.

Keep this in mind

Roundness aur shadow alag effects hain; shadow ke liye w3-card use karein.

01 · Understand02 · See every example03 · Try it yourself

Detailed explanation & examples

Compare each visual with the code directly below it.

W3.CSS Rounded Panel

The w3-round class rounds the corners of elements. Combine it with w3-panel for elegant designs.

This is a W3.CSS rounded panel. Rounded corners add a modern and polished look.

Example
<div class="w3-panel w3-border w3-light-grey w3-round example-box">
<p>This is a W3.CSS rounded panel. Rounded corners add a modern and polished look.</p>
</div>

Try a complete example

Try this lesson
index.html
<div class="w3-panel w3-blue w3-round-large"><h2>Rounded panel</h2><p>Try w3-round, w3-round-large and w3-round-xlarge.</p></div>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Button
Framework & classes

W3.CSS Button

Understand the concept

w3-button padding aur hover styling deta hai. w3-blue se colour aur w3-round se rounded corners add karein.

Keep this in mind

Button ki appearance aur uska action alag hain. Action ke liye HTML form ya JavaScript chahiye.

01 · Understand02 · See every example03 · Try it yourself

Detailed explanation & examples

Compare each visual with the code directly below it.

1. W3.CSS Button

The w3-button class styles buttons with padding and hover effects; add w3-round for rounded corners.

Example
<button class="w3-button w3-green w3-round w3-hover-blue">Click Me</button>

This is an example of a styled W3.CSS button.

1. W3.CSS Button

The w3-button class styles buttons with padding and hover effects; add w3-round for rounded corners.

Example
<button class="w3-button w3-green w3-round w3-hover-blue">Click Me</button>

This is an example of a styled W3.CSS button.

Try a complete example

Try this lesson
index.html
<button class="w3-button w3-blue">Button</button> <button class="w3-button w3-green w3-round">Rounded</button> <button class="w3-button w3-red w3-hover-black">Hover</button>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Display Container
Framework & classes

W3.CSS Display Container

Understand the concept

w3-display-container parent ko positioning context deta hai. Andar w3-display-topleft, w3-display-middle aur doosre position classes use karein.

Keep this in mind

Position classes ko display container ke andar lagayein aur container ko visible height dein.

01 · Understand02 · See every example03 · Try it yourself

Detailed explanation & examples

Compare each visual with the code directly below it.

2. W3.CSS Display Container

The w3-display-container class is used to position elements within a container easily.

Top Right
Bottom Left

This is a display container.

Example
<p class="w3-display-middle">This is a display container.</p>
Example
<div class="w3-display-container example-box w3-border w3-light-grey" style="height: 200px;">
<div class="w3-display-topright w3-padding w3-light-green">
                Top Right
            </div>
<div class="w3-display-bottomleft w3-padding w3-light-blue">
                Bottom Left
            </div>
<p class="w3-display-middle">This is a display container.</p>
</div>

Try a complete example

Try this lesson
index.html
<div class="w3-display-container w3-pale-blue" style="height:240px"><span class="w3-display-topleft w3-padding">Top left</span><span class="w3-display-middle">Middle</span><span class="w3-display-bottomright w3-padding">Bottom right</span></div>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERCollapsible Panel
Framework & classes

Collapsible Panel

Understand the concept

Button par click karne se panel ki visibility JavaScript se toggle hoti hai. W3.CSS panel aur button ka design deta hai.

Keep this in mind

CSS class apne aap click behaviour nahi banati. Button ke saath toggle handler bhi chahiye.

01 · Understand02 · See every example03 · Try it yourself

Detailed explanation & examples

Compare each visual with the code directly below it.

3. Collapsible Panel

A collapsible panel allows content to be toggled open or closed using buttons.

My Heading

This is the content inside the collapsible panel. You can hide or show this section by clicking the button above.

2. Collapsible Panel

A collapsible panel allows content to be toggled open or closed using buttons.

This is the content inside the collapsible panel. You can hide or show this section by clicking the button above.

Example
<div class="w3-panel w3-border w3-light-grey w3-round w3-hide example-box" id="collapsiblePanel">
<p>This is the content inside the collapsible panel. You can hide or show this section by clicking the button above.</p>
</div>

Try a complete example

Try this lesson
index.html
<button class="w3-button w3-blue" onclick="document.getElementById('panel').classList.toggle('w3-hide')">Toggle panel</button>
<div id="panel" class="w3-panel w3-pale-blue w3-hide"><p>W3.CSS styles the panel; JavaScript toggles its visibility.</p></div>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Display Positions
Framework & classes

W3.CSS Display Positions

Understand the concept

w3-display-container parent ko positioning context deta hai. Andar w3-display-topleft, w3-display-middle aur doosre position classes use karein.

Keep this in mind

Position classes ko display container ke andar lagayein aur container ko visible height dein.

01 · Understand02 · See every example03 · Try it yourself

Detailed explanation & examples

Compare each visual with the code directly below it.

4. W3.CSS Display Positions

Use w3-display-position classes like w3-display-topright, w3-display-middle, and more to position elements within containers.

Top Right
Center
Example
<div class="w3-display-container example-box w3-border w3-light-grey" style="height: 200px;">
<div class="w3-display-topright w3-padding w3-light-green">Top Right</div>
<div class="w3-display-middle w3-padding w3-light-blue">Center</div>
</div>

Try a complete example

Try this lesson
index.html
<div class="w3-display-container w3-pale-green" style="height:240px"><span class="w3-display-topright w3-padding">Top right</span><span class="w3-display-left w3-padding">Left</span><span class="w3-display-bottommiddle w3-padding">Bottom middle</span></div>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Lists
Framework & classes

W3.CSS Lists

Understand the concept

w3-ul se list items ko consistent spacing aur separators milte hain. w3-border aur w3-hoverable se list ko customise karein.

Keep this in mind

Closable item hide karne ke liye button ke saath click behaviour chahiye.

01 · Understand02 · See every example03 · Try it yourself

Detailed explanation & examples

Compare each visual with the code directly below it.

W3.CSS Lists

W3.CSS provides the w3-ul class to create styled, uniform, and responsive lists. Additional classes such as w3-border, w3-center, and w3-hoverable can enhance their appearance.

  • List Item 1
  • List Item 2
  • List Item 3
  • List Item 4
Example
<ul class="w3-ul w3-border w3-hoverable example-box">
<li class="w3-center w3-light-green">List Item 1</li>
<li>List Item 2</li>
<li class="w3-center">List Item 3</li>
<li>List Item 4</li>
</ul>

Here is a styled list using W3.CSS:

  • Item 1: Standard list item with border
  • Item 2: Hover over for effect
  • Item 3: Centered and styled
  • Item 4: Responsive and clean
Example
<ul class="w3-ul w3-border w3-hoverable">
<li>Item 1: Standard list item with border</li>
<li>Item 2: Hover over for effect</li>
<li>Item 3: Centered and styled</li>
<li>Item 4: Responsive and clean</li>
</ul>

3. W3.CSS Lists

Closable List Items

Closable list

  • Uttar Pradesh
  • Maharashtra
  • Tamil Nadu
Example
<ul class="w3-ul w3-border">
<li class="w3-display-container">Uttar Pradesh
      <span class="w3-button w3-display-topright w3-red">
        x
      </span>
</li>
<li class="w3-display-container">Maharashtra
      <span class="w3-button w3-display-topright w3-red">
        x
      </span>
</li>
<li class="w3-display-container">Tamil Nadu
      <span class="w3-button w3-display-topright w3-red">
        x
      </span>
</li>
</ul>

Avatar List

You can combine w3-ul and the w3-bar classes to create an avatar list:

  • Example image
    Example
    <img class="w3-bar-item w3-circle w3-hide-small" src="/practice-media/landscape.svg" style="width:100px; height:75px;"/>
    Mike
    Web Designer
  • Example image
    Example
    <img class="w3-bar-item w3-circle w3-hide-small" src="/practice-media/study.svg" style="width:85px"/>
    Jill
    Support
  • Example image
    Example
    <img class="w3-bar-item w3-circle w3-hide-small" src="/practice-media/study.svg" style="width:85px"/>
    Jane
    Accountant
Example
<ul class="w3-ul w3-card-4 w3-white">
<li class="w3-bar">
<span class="w3-bar-item w3-button w3-white w3-xlarge w3-right">×</span>
<img class="w3-bar-item w3-circle w3-hide-small" src="/practice-media/landscape.svg" style="width:100px; height:75px;"/>
<div class="w3-bar-item">
<span class="w3-large">Mike</span><br/>
<span>Web Designer</span>
</div>
</li>
<li class="w3-bar">
<span class="w3-bar-item w3-button w3-white w3-xlarge w3-right">×</span>
<img class="w3-bar-item w3-circle w3-hide-small" src="/practice-media/study.svg" style="width:85px"/>
<div class="w3-bar-item">
<span class="w3-large">Jill</span><br/>
<span>Support</span>
</div>
</li>
<li class="w3-bar">
<span class="w3-bar-item w3-button w3-white w3-xlarge w3-right">×</span>
<img class="w3-bar-item w3-circle w3-hide-small" src="/practice-media/study.svg" style="width:85px"/>
<div class="w3-bar-item">
<span class="w3-large">Jane</span><br/>
<span>Accountant</span>
</div>
</li>
</ul>

List Sizes

The size of the list can be adjusted using W3.CSS classes like w3-small, w3-large, and more.

  • Small List Item
  • Small List Item
Example
<ul class="w3-ul w3-border w3-small">
<li>Small List Item</li>
<li>Small List Item</li>
</ul>
  • Large List Item
  • Large List Item
Example
<ul class="w3-ul w3-border w3-large">
<li>Large List Item</li>
<li>Large List Item</li>
</ul>

Try a complete example

Try this lesson
index.html
<ul class="w3-ul w3-card"><li class="w3-hover-blue">HTML</li><li class="w3-hover-green">CSS</li><li>W3.CSS <button class="w3-button w3-right" onclick="this.parentElement.remove()" aria-label="Remove W3.CSS item">×</button></li></ul>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Image Classes
Framework & classes

W3.CSS Image Classes

Understand the concept

w3-round corners, w3-circle circular shape, w3-border boundary aur w3-grayscale grey colour effect deta hai.

Keep this in mind

Square image ya square crop par w3-circle ek circle banata hai. Opacity transparency hai, grayscale colour effect hai.

01 · Understand02 · See every example03 · Try it yourself

Detailed explanation & examples

Compare each visual with the code directly below it.

W3.CSS Image Classes

Learn how to style images using W3.CSS classes like w3-round, w3-circle, w3-border, and w3-grayscale.

Example
<p class="w3-center">Learn how to style images using W3.CSS classes like <code>w3-round</code>, <code>w3-circle</code>, <code>w3-border</code>, and <code>w3-grayscale</code>.</p>

1. Rounded Corners (w3-round)

This class applies rounded corners to the image, giving it a smooth and modern look.

Rounded Corners
Example
<img alt="Rounded Corners" class="w3-round" src="/practice-media/landscape.svg"/>

2. Circle (w3-circle)

The w3-circle class creates a circular image. This is ideal for profile pictures or decorative elements.

Circle Image
Example
<img alt="Circle Image" class="w3-circle" src="/practice-media/landscape.svg" style="width:150px; height:150px;"/>

3. Bordered Image (w3-border)

Adds a simple border around the image, which enhances visibility and separates it from the background.

Bordered Image
Example
<img alt="Bordered Image" class="w3-border" src="/practice-media/landscape.svg" style="border-width: 3px;"/>

4. Grayscale Image (w3-grayscale)

Converts the image to grayscale. This is useful for placeholders, subdued backgrounds, or stylish effects.

Grayscale Image
Example
<img alt="Grayscale Image" class="w3-grayscale" src="/practice-media/landscape.svg"/>

Image Text

Position content inside an image with the w3-display-classes - Note that we have added the w3-container class to get more padding:

Lights

Top Left

Top Right

Bottom Left

Bottom Right

Left

Right

Middle

Top Middle

Bottom Middle

Handwritten PDF · pages 10

Opacity and grayscale are different

Opacity image ko transparent banati hai; grayscale uske colours ko grey banata hai. Dono effects ko compare karein.

Mountain landscape, w3-opacity
Example
<img class="w3-image w3-opacity" src="photo.jpg" alt="Mountain view">
Mountain landscape, w3-grayscale
Example
<img class="w3-image w3-grayscale" src="photo.jpg" alt="Mountain view">
Mountain landscape, w3-grayscale-max
Example
<img class="w3-image w3-grayscale-max" src="photo.jpg" alt="Mountain view">

Try a complete example

Try this lesson
index.html
<img src="/practice-media/study.svg" class="w3-image w3-round-large" alt="Study workspace" style="width:200px"><img src="/practice-media/landscape.svg" class="w3-image w3-circle w3-border w3-grayscale" alt="Mountain landscape" style="width:200px;height:200px;object-fit:cover">

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERW3.CSS Responsive Grid
More practice

W3.CSS Responsive Grid

Understand the concept

w3-row-padding aur w3-third se responsive columns banayein.

Keep this in mind

Small changes karke output compare karein. Narrow screen par bhi layout test karein.

01 · Understand02 · See every example03 · Try it yourself

Detailed explanation & examples

Compare each visual with the code directly below it.

Example
<div class="w3-row-padding"><div class="w3-third w3-blue w3-padding">Column 1</div><div class="w3-third w3-green w3-padding">Column 2</div><div class="w3-third w3-orange w3-padding">Column 3</div></div>

Try a complete example

Try this lesson
index.html
<div class="w3-row-padding"><div class="w3-third w3-blue w3-padding">Column 1</div><div class="w3-third w3-green w3-padding">Column 2</div><div class="w3-third w3-orange w3-padding">Column 3</div></div>

Open the compiler to change the code and experiment with the result.

KEEP SCROLLING · NEXT CHAPTERCards and Animations
More practice

Cards and Animations

Understand the concept

w3-card-4 shadow aur w3-animate-opacity fade effect deta hai. Motion ko limited aur purposeful rakhein.

Keep this in mind

Small changes karke output compare karein. Narrow screen par bhi layout test karein.

01 · Understand02 · See every example03 · Try it yourself

Detailed explanation & examples

Compare each visual with the code directly below it.

Example
<div class="w3-container w3-padding"><div class="w3-card-4 w3-round w3-padding w3-animate-opacity"><h2>Study card</h2><p>A card with a shadow and fade animation.</p><button class="w3-button w3-blue">Learn more</button></div></div>

Try a complete example

Try this lesson
index.html
<div class="w3-container w3-padding"><div class="w3-card-4 w3-round w3-padding w3-animate-opacity"><h2>Study card</h2><p>A card with a shadow and fade animation.</p><button class="w3-button w3-blue">Learn more</button></div></div>

Open the compiler to change the code and experiment with the result.

You have reached the end of the guide.

Revise a chapter using the sidebar, or put your skills into practice.

Explore practice projects
Hi! 👋
KnoblyAI
Online

Hello! 👋

Your futuristic AI learning companion

KnoblyAI can make mistakes. Double-check important replies.