<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0">

<channel>
	<title>HTML5 &amp; CSS3</title>
	<atom:link href="https://html5andcss3.org/feed/" rel="self" type="application/rss+xml"/>
	<link>https://html5andcss3.org/</link>
	<description>Tools and Tutorials</description>
	<lastBuildDate>Thu, 02 Apr 2026 14:05:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://html5andcss3.org/wp-content/uploads/2025/10/cropped-html5_and_css3_favicon-32x32.png</url>
	<title>HTML5 &amp; CSS3</title>
	<link>https://html5andcss3.org/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<itunes:explicit>no</itunes:explicit><itunes:subtitle>Tools and Tutorials</itunes:subtitle><item>
		<title>CSS Width and Height</title>
		<link>https://html5andcss3.org/tutorials/css/css-width-and-height/</link>
					<comments>https://html5andcss3.org/tutorials/css/css-width-and-height/#respond</comments>
		
		<dc:creator><![CDATA[Swapnil Raja]]></dc:creator>
		<pubDate>Thu, 02 Apr 2026 14:05:08 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Box Model]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://html5andcss3.org/?p=3665</guid>

					<description><![CDATA[<p>The CSS Width and Height properties are used to define the size of an HTML element. These properties help in designing layouts and controlling how elements appear on a webpage. 👉 This sets the element width to 200px and height to 100px. Attributes Property Description Example width Sets element width width: 300px; height Sets element [&#8230;]</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-width-and-height/">CSS Width and Height</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>The <strong>CSS Width and Height</strong> properties are used to define the <strong>size of an HTML element</strong>.</p>
</blockquote>



<ul class="wp-block-list">
<li><strong>Width</strong> → controls the horizontal size</li>



<li><strong>Height</strong> → controls the vertical size</li>
</ul>



<p>These properties help in designing layouts and controlling how elements appear on a webpage.</p>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Syntax</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">selector {
    width: value;
    height: value;
}</code></pre></div>

<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">div {
    width: 200px;
    height: 100px;
}</code></pre></div>


<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> This sets the element width to <strong>200px</strong> and height to <strong>100px</strong>.</p>



<h3 class="wp-block-heading">Attributes</h3>



<figure class="wp-block-table"><table class="has-fixed-layout" style="border-width:1px"><thead><tr><th>Property</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>width</td><td>Sets element width</td><td>width: 300px;</td></tr><tr><td>height</td><td>Sets element height</td><td>height: 150px;</td></tr><tr><td>max-width</td><td>Sets maximum width</td><td>max-width: 100%;</td></tr><tr><td>min-width</td><td>Sets minimum width</td><td>min-width: 200px;</td></tr><tr><td>max-height</td><td>Sets maximum height</td><td>max-height: 400px;</td></tr></tbody></table></figure>



<h2 class="wp-block-heading">Example</h2>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Complete CSS Width and Height Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button><button class="cbe-try-it-btn" data-language="html">Try It</button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;CSS Width and Height&lt;/title&gt;
    &lt;style&gt;
        div {
            width: 300px;
            height: 150px;
            background-color: lightblue;
            padding: 10px;
            border: 2px solid black;
        }

        img {
            width: 200px;
            height: auto;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;div&gt;This box has fixed width and height.&lt;/div&gt;

    &lt;img src="image.jpg" alt="Sample Image"&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre></div>


<h2 class="wp-block-heading">Output</h2>



<h3 class="wp-block-heading">Browser Output</h3>



<pre class="wp-block-preformatted">The <code>&lt;div></code> will appear as a fixed-size box (300px × 150px)<br>The box will have background color, padding, and border<br>The image will have a fixed width and proportional height</pre>



<h3 class="wp-block-heading">Browser Support</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/chrome.webp" alt="Chrome" width="32"><br>Chrome</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/firefox.webp" alt="Firefox" width="32"><br>Firefox</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/edge.webp" alt="Edge" width="32"><br>Edge</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/safari.webp" alt="Safari" width="32"><br>Safari</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/opera.webp" alt="Opera" width="32"><br>Opera</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/internet.webp" alt="IE" width="32"><br>IE9+</th></tr><tr><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td></tr></tbody></table></figure>



<p></p>



<h2 class="wp-block-heading">Notes</h2>



<ul class="wp-block-list">
<li>Width and height can be set using:
<ul class="wp-block-list">
<li><code>px</code> (pixels)</li>



<li><code>%</code> (percentage)</li>



<li><code>auto</code> (default)</li>
</ul>
</li>



<li><code>height: auto</code> maintains aspect ratio for images</li>



<li>Use <code>max-width: 100%</code> for responsive design</li>



<li>Padding and border can affect total size (box model)</li>



<li>Avoid fixed heights for flexible layouts</li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p>CSS Width and Height properties are essential for controlling element size and layout. When used properly, they help create responsive and well-structured web designs.</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-width-and-height/">CSS Width and Height</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://html5andcss3.org/tutorials/css/css-width-and-height/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CSS Outline</title>
		<link>https://html5andcss3.org/tutorials/css/css-outline/</link>
					<comments>https://html5andcss3.org/tutorials/css/css-outline/#respond</comments>
		
		<dc:creator><![CDATA[Swapnil Raja]]></dc:creator>
		<pubDate>Thu, 02 Apr 2026 14:00:11 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Box Model]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://html5andcss3.org/?p=3663</guid>

					<description><![CDATA[<p>The CSS Outline property is used to draw a line outside an element’s border. It is similar to a border, but with some key differences: 👉 This adds a 2px red outline outside the element. Attributes Property Description Example outline Sets all outline properties outline: 2px solid black; outline-width Sets thickness of outline outline-width: 3px; [&#8230;]</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-outline/">CSS Outline</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>The <strong>CSS Outline</strong> property is used to draw a line <strong>outside an element’s border</strong>.</p>
</blockquote>



<p>It is similar to a border, but with some key differences:</p>



<ul class="wp-block-list">
<li>It does <strong>not take up space</strong> (does not affect layout)</li>



<li>It appears <strong>outside the border</strong></li>



<li>It is often used for <strong>highlighting elements</strong>, especially for focus states</li>
</ul>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Syntax</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">selector {
    outline: width style color;
}</code></pre></div>

<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">p {
    outline: 2px solid red;
}</code></pre></div>


<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> This adds a <strong>2px red outline outside the element</strong>.</p>



<h3 class="wp-block-heading">Attributes</h3>



<figure class="wp-block-table"><table class="has-fixed-layout" style="border-width:1px"><thead><tr><th>Property</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>outline</td><td>Sets all outline properties</td><td>outline: 2px solid black;</td></tr><tr><td>outline-width</td><td>Sets thickness of outline</td><td>outline-width: 3px;</td></tr><tr><td>outline-style</td><td>Defines outline style</td><td>outline-style: dashed;</td></tr><tr><td>outline-color</td><td>Sets outline color</td><td>outline-color: red;</td></tr><tr><td>outline-offset</td><td>Adds space between border and outline</td><td>outline-offset: 5px;</td></tr></tbody></table></figure>



<h2 class="wp-block-heading">Example</h2>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Complete CSS Outline Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button><button class="cbe-try-it-btn" data-language="html">Try It</button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;CSS Outline Example&lt;/title&gt;
    &lt;style&gt;
        div {
            border: 2px solid blue;
            outline: 3px dashed red;
            outline-offset: 5px;
            padding: 10px;
        }

        p {
            outline: 2px solid green;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;div&gt;This div has both border and outline.&lt;/div&gt;

    &lt;p&gt;This paragraph has an outline.&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre></div>


<h2 class="wp-block-heading">Output</h2>



<h3 class="wp-block-heading">Browser Output</h3>



<pre class="wp-block-preformatted">The <code>&lt;div></code> will have:<br>A blue border<br>A red dashed outline outside the border<br>The <code>&lt;p></code> will have a green outline<br>The outline will not affect spacing between elements</pre>



<h3 class="wp-block-heading">Browser Support</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/chrome.webp" alt="Chrome" width="32"><br>Chrome</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/firefox.webp" alt="Firefox" width="32"><br>Firefox</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/edge.webp" alt="Edge" width="32"><br>Edge</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/safari.webp" alt="Safari" width="32"><br>Safari</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/opera.webp" alt="Opera" width="32"><br>Opera</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/internet.webp" alt="IE" width="32"><br>IE9+</th></tr><tr><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td></tr></tbody></table></figure>



<p></p>



<h2 class="wp-block-heading">Notes</h2>



<ul class="wp-block-list">
<li>Outline does <strong>not take up space</strong> (unlike border)</li>



<li>It is drawn <strong>outside the border</strong></li>



<li>Commonly used for <strong>focus effects</strong> (e.g., input fields)</li>



<li>Supports <code>outline-offset</code> for spacing</li>



<li>Cannot apply different outlines to each side</li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p>CSS Outline is a useful property for highlighting elements without affecting layout. It is especially helpful for accessibility and focus styling, making it an important part of modern web design.</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-outline/">CSS Outline</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://html5andcss3.org/tutorials/css/css-outline/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CSS Border</title>
		<link>https://html5andcss3.org/tutorials/css/css-border/</link>
					<comments>https://html5andcss3.org/tutorials/css/css-border/#respond</comments>
		
		<dc:creator><![CDATA[Swapnil Raja]]></dc:creator>
		<pubDate>Thu, 02 Apr 2026 13:55:45 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Box Model]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://html5andcss3.org/?p=3661</guid>

					<description><![CDATA[<p>The CSS Border property is used to define the outline around an HTML element. It helps in visually separating elements and improving layout structure by adding lines around content. A border consists of three main parts: 👉 This adds a 2px solid red border around all &#60;p> elements. Attributes Property Description Example border Sets all [&#8230;]</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-border/">CSS Border</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>The <strong>CSS Border</strong> property is used to define the <strong>outline around an HTML element</strong>.</p>
</blockquote>



<p>It helps in visually separating elements and improving layout structure by adding lines around content.</p>



<p>A border consists of three main parts:</p>



<ul class="wp-block-list">
<li><strong>Width</strong> (thickness)</li>



<li><strong>Style</strong> (solid, dashed, etc.)</li>



<li><strong>Color</strong></li>
</ul>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Syntax</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">selector {
    border: width style color;
}</code></pre></div>

<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button><button class="cbe-try-it-btn" data-language="html">Try It</button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">p {
    border: 2px solid red;
}</code></pre></div>


<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> This adds a <strong>2px solid red border</strong> around all <code>&lt;p></code> elements.</p>



<h3 class="wp-block-heading">Attributes</h3>



<figure class="wp-block-table"><table class="has-fixed-layout" style="border-width:1px"><thead><tr><th>Property</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>border</td><td>Sets all border properties</td><td>border: 1px solid black;</td></tr><tr><td>border-width</td><td>Sets border thickness</td><td>border-width: 2px;</td></tr><tr><td>border-style</td><td>Defines border style</td><td>border-style: dashed;</td></tr><tr><td>border-color</td><td>Sets border color</td><td>border-color: red;</td></tr><tr><td>border-radius</td><td>Rounds the corners of border</td><td>border-radius: 10px;</td></tr></tbody></table></figure>



<h2 class="wp-block-heading">Example</h2>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Complete CSS Border Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button><button class="cbe-try-it-btn" data-language="html">Try It</button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;CSS Border Example&lt;/title&gt;
    &lt;style&gt;
        div {
            border: 2px solid blue;
            padding: 10px;
        }

        p {
            border: 1px dashed red;
            padding: 10px;
        }

        h1 {
            border: 3px solid black;
            border-radius: 10px;
            padding: 10px;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;h1&gt;Border Example&lt;/h1&gt;

    &lt;div&gt;This is a div with solid border.&lt;/div&gt;

    &lt;p&gt;This paragraph has dashed border.&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre></div>


<h2 class="wp-block-heading">Output</h2>



<h3 class="wp-block-heading">Browser Output</h3>



<pre class="wp-block-preformatted">The heading will have a solid black border with rounded corners<br>The <code>&lt;div></code> will have a blue solid border<br>The <code>&lt;p></code> will have a red dashed border<br>Padding will create space inside the borders</pre>



<h3 class="wp-block-heading">Browser Support</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/chrome.webp" alt="Chrome" width="32"><br>Chrome</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/firefox.webp" alt="Firefox" width="32"><br>Firefox</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/edge.webp" alt="Edge" width="32"><br>Edge</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/safari.webp" alt="Safari" width="32"><br>Safari</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/opera.webp" alt="Opera" width="32"><br>Opera</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/internet.webp" alt="IE" width="32"><br>IE9+</th></tr><tr><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td></tr></tbody></table></figure>



<p></p>



<h2 class="wp-block-heading">Notes</h2>



<ul class="wp-block-list">
<li>Border requires at least <strong>style</strong> to be visible</li>



<li>You can set borders individually:
<ul class="wp-block-list">
<li><code>border-top</code>, <code>border-right</code>, <code>border-bottom</code>, <code>border-left</code></li>
</ul>
</li>



<li><code>border-radius</code> is used for rounded corners</li>



<li>Borders increase the total size of an element</li>



<li>Works together with margin and padding</li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p>CSS Border is essential for defining element boundaries and enhancing visual structure. By customizing width, style, and color, you can create clean and attractive layouts.</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-border/">CSS Border</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://html5andcss3.org/tutorials/css/css-border/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CSS Padding</title>
		<link>https://html5andcss3.org/tutorials/css/css-padding/</link>
					<comments>https://html5andcss3.org/tutorials/css/css-padding/#respond</comments>
		
		<dc:creator><![CDATA[Swapnil Raja]]></dc:creator>
		<pubDate>Thu, 02 Apr 2026 13:50:59 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Box Model]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://html5andcss3.org/?p=3659</guid>

					<description><![CDATA[<p>The CSS Padding property is used to create space inside an element, between the content and its border. It helps improve readability and design by adding inner spacing, making content look less crowded. 👉 In simple terms:Margin = outside spacingPadding = inside spacing 👉 This adds 20px space inside the element on all sides. Attributes [&#8230;]</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-padding/">CSS Padding</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>The <strong>CSS Padding</strong> property is used to create <strong>space inside an element, between the content and its border</strong>.</p>
</blockquote>



<p>It helps improve readability and design by adding inner spacing, making content look less crowded.</p>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> In simple terms:<br><strong>Margin = outside spacing</strong><br><strong>Padding = inside spacing</strong></p>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Syntax</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">selector {
    padding: value;
}</code></pre></div>

<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">p {
    padding: 20px;
}</code></pre></div>


<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> This adds <strong>20px space inside the element on all sides</strong>.</p>



<h3 class="wp-block-heading">Attributes</h3>



<figure class="wp-block-table"><table class="has-fixed-layout" style="border-width:1px"><thead><tr><th>Property</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>padding</td><td>Sets padding on all sides</td><td>padding: 10px;</td></tr><tr><td>padding-top</td><td>Sets top padding</td><td>padding-top: 20px;</td></tr><tr><td>padding-right</td><td>Sets right padding</td><td>padding-right: 15px;</td></tr><tr><td>padding-bottom</td><td>Sets bottom padding</td><td>padding-bottom: 25px;</td></tr><tr><td>padding-left</td><td>Sets left padding</td><td>padding-left: 10px;</td></tr></tbody></table></figure>



<h2 class="wp-block-heading">Example</h2>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Complete CSS Padding Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button><button class="cbe-try-it-btn" data-language="html">Try It</button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;CSS Padding Example&lt;/title&gt;
    &lt;style&gt;
        div {
            background-color: lightblue;
            padding: 20px;
            border: 2px solid black;
        }

        p {
            background-color: yellow;
            padding-left: 30px;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;div&gt;This is a div with padding.&lt;/div&gt;

    &lt;p&gt;This paragraph has left padding.&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre></div>


<h2 class="wp-block-heading">Output</h2>



<h3 class="wp-block-heading">Browser Output</h3>



<pre class="wp-block-preformatted">The <code>&lt;div></code> will have space inside it (20px on all sides)<br>The content inside the div will not touch the border<br>The <code>&lt;p></code> will have extra space on the left side<br>Overall layout will look more spaced and readable</pre>



<h3 class="wp-block-heading">Browser Support</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/chrome.webp" alt="Chrome" width="32"><br>Chrome</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/firefox.webp" alt="Firefox" width="32"><br>Firefox</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/edge.webp" alt="Edge" width="32"><br>Edge</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/safari.webp" alt="Safari" width="32"><br>Safari</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/opera.webp" alt="Opera" width="32"><br>Opera</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/internet.webp" alt="IE" width="32"><br>IE9+</th></tr><tr><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td></tr></tbody></table></figure>



<p></p>



<h2 class="wp-block-heading">Notes</h2>



<ul class="wp-block-list">
<li>Padding creates space <strong>inside the element</strong></li>



<li>It increases the <strong>total size</strong> of the element</li>



<li>Supports shorthand:
<ul class="wp-block-list">
<li><code>padding: 10px 20px;</code></li>



<li><code>padding: 10px 15px 20px 25px;</code></li>
</ul>
</li>



<li>Background color is visible in padding area Works together with border and margin in the <strong>box model</strong></li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p>CSS Padding is crucial for improving content spacing and readability. By adding space inside elements, it enhances design clarity and ensures a better user experience.</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-padding/">CSS Padding</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://html5andcss3.org/tutorials/css/css-padding/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CSS Margin</title>
		<link>https://html5andcss3.org/tutorials/css/css-margin/</link>
					<comments>https://html5andcss3.org/tutorials/css/css-margin/#respond</comments>
		
		<dc:creator><![CDATA[Swapnil Raja]]></dc:creator>
		<pubDate>Thu, 02 Apr 2026 13:46:22 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Box Model]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://html5andcss3.org/?p=3657</guid>

					<description><![CDATA[<p>The CSS Margin property is used to create space outside an element’s border.It controls the distance between an element and surrounding elements, helping to create proper layout and spacing on a webpage. Margins are transparent and do not have a background color. 👉 This adds 20px space on all sides of the paragraph. Attributes Property [&#8230;]</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-margin/">CSS Margin</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>The <strong>CSS Margin</strong> property is used to create <strong>space outside an element’s border</strong>.<br>It controls the distance between an element and surrounding elements, helping to create proper <strong>layout and spacing</strong> on a webpage.</p>
</blockquote>



<p>Margins are transparent and do not have a background color.</p>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Syntax</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">selector {
    margin: value;
}</code></pre></div>

<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">p {
margin: 20px;
}</code></pre></div>


<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> This adds <strong>20px space on all sides</strong> of the paragraph.</p>



<h3 class="wp-block-heading">Attributes</h3>



<figure class="wp-block-table"><table class="has-fixed-layout" style="border-width:1px"><thead><tr><th>Property</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>margin</td><td>Sets margin on all sides</td><td>margin: 10px;</td></tr><tr><td>margin-top</td><td>Sets top margin</td><td>margin-top: 20px;</td></tr><tr><td>margin-right</td><td>Sets right margin</td><td>margin-right: 15px;</td></tr><tr><td>margin-bottom</td><td>Sets bottom margin</td><td>margin-bottom: 25px;</td></tr><tr><td>margin-left</td><td>Sets left margin</td><td>margin-left: 10px;</td></tr></tbody></table></figure>



<h2 class="wp-block-heading">Example</h2>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Complete CSS Margin Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button><button class="cbe-try-it-btn" data-language="html">Try It</button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;CSS Margin Example&lt;/title&gt;
    &lt;style&gt;
        div {
            background-color: lightblue;
            margin: 20px;
            padding: 10px;
        }

        p {
            background-color: yellow;
            margin-top: 30px;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;div&gt;This is a div with margin.&lt;/div&gt;

    &lt;p&gt;This paragraph has top margin.&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre></div>


<h2 class="wp-block-heading">Output</h2>



<h3 class="wp-block-heading">Browser Output</h3>



<pre class="wp-block-preformatted">The <code>&lt;div></code> will have space around it (20px on all sides)<br>The <code>&lt;p></code> will have extra space above it (30px)<br>Elements will not touch each other due to margin spacing</pre>



<h3 class="wp-block-heading">Browser Support</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/chrome.webp" alt="Chrome" width="32"><br>Chrome</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/firefox.webp" alt="Firefox" width="32"><br>Firefox</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/edge.webp" alt="Edge" width="32"><br>Edge</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/safari.webp" alt="Safari" width="32"><br>Safari</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/opera.webp" alt="Opera" width="32"><br>Opera</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/internet.webp" alt="IE" width="32"><br>IE9+</th></tr><tr><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td></tr></tbody></table></figure>



<p></p>



<h2 class="wp-block-heading">Notes</h2>



<ul class="wp-block-list">
<li>Margin creates space <strong>outside the element</strong></li>



<li>It is different from padding (which is inside spacing)</li>



<li>You can set margin for individual sides Supports shorthand values:
<ul class="wp-block-list">
<li><code>margin: 10px 20px;</code> (top-bottom, left-right)</li>



<li><code>margin: 10px 15px 20px 25px;</code> (top, right, bottom, left)</li>
</ul>
</li>



<li>Margin can be set to <code>auto</code> for centering elements</li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p>CSS Margin is essential for controlling layout spacing between elements. It helps create clean, organized designs by ensuring proper distance and alignment across different parts of a webpage.</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-margin/">CSS Margin</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://html5andcss3.org/tutorials/css/css-margin/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CSS Background Image</title>
		<link>https://html5andcss3.org/tutorials/css/css-background-image/</link>
					<comments>https://html5andcss3.org/tutorials/css/css-background-image/#respond</comments>
		
		<dc:creator><![CDATA[Swapnil Raja]]></dc:creator>
		<pubDate>Wed, 01 Apr 2026 14:27:37 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Colors & Backgrounds]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://html5andcss3.org/?p=3620</guid>

					<description><![CDATA[<p>The CSS Background Image property is used to set an image as the background of an HTML element. It allows you to enhance the visual design of a webpage by adding images behind content such as: You can also control how the image behaves using additional background properties. 👉 This sets an image as the [&#8230;]</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-background-image/">CSS Background Image</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>The <strong>CSS Background Image</strong> property is used to set an <strong>image as the background of an HTML element</strong>.</p>
</blockquote>



<p>It allows you to enhance the visual design of a webpage by adding images behind content such as:</p>



<ul class="wp-block-list">
<li>Entire page (body)</li>



<li>Sections (div)</li>



<li>Headers</li>
</ul>



<p>You can also control how the image behaves using additional background properties.</p>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Syntax</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.c"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-c">selector {
    background-image: url("image.jpg");
}</code></pre></div>

<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.css"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-css">body {
    background-image: url("background.jpg");
}</code></pre></div>


<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> This sets an image as the background of the page.</p>



<h3 class="wp-block-heading">Attributes</h3>



<figure class="wp-block-table"><table class="has-fixed-layout" style="border-width:1px"><thead><tr><th>Property</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>background-image</td><td>Sets background image</td><td>background-image: url(&#8220;img.jpg&#8221;);</td></tr><tr><td>background-repeat</td><td>Controls image repetition</td><td>background-repeat: no-repeat;</td></tr><tr><td>background-size</td><td>Defines image size</td><td>background-size: cover;</td></tr><tr><td>background-position</td><td>Sets image position</td><td>background-position: center;</td></tr><tr><td>background-attachment</td><td>Defines scrolling behavior</td><td>background-attachment: fixed;</td></tr></tbody></table></figure>



<h2 class="wp-block-heading">Example</h2>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Complete CSS Example for Background Image</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button><button class="cbe-try-it-btn" data-language="html">Try It</button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;CSS Background Image&lt;/title&gt;
    &lt;style&gt;
        body {
            background-image: url("https://picsum.photos/500/500?grayscale");
            background-repeat: no-repeat;
            background-size: cover;
            background-position: center;
        }
        h1 {
            color: white;
            text-align: center;
        }
        p {
            color: yellow;
            text-align: center;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;h1&gt;Background Image Example&lt;/h1&gt;
    &lt;p&gt;This page uses a background image.&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre></div>


<h2 class="wp-block-heading">Output</h2>



<h3 class="wp-block-heading">Browser Output</h3>



<pre class="wp-block-preformatted">The page will display a full-screen background image<br>The image will not repeat<br>The image will be centered and cover the entire screen<br>Text will appear on top of the image</pre>



<h3 class="wp-block-heading">Browser Support</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/chrome.webp" alt="Chrome" width="32"><br>Chrome</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/firefox.webp" alt="Firefox" width="32"><br>Firefox</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/edge.webp" alt="Edge" width="32"><br>Edge</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/safari.webp" alt="Safari" width="32"><br>Safari</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/opera.webp" alt="Opera" width="32"><br>Opera</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/internet.webp" alt="IE" width="32"><br>IE9+</th></tr><tr><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td></tr></tbody></table></figure>



<p></p>



<h2 class="wp-block-heading">Notes</h2>



<ul class="wp-block-list">
<li>Always use <code>url()</code> to define the image path</li>



<li>Use <code>background-size: cover</code> for full-screen effect</li>



<li>Use <code>no-repeat</code> to prevent image repetition</li>



<li>Ensure text is readable over the background image</li>



<li>Optimize images for faster page loading</li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p>CSS Background Image allows you to create visually rich and engaging web pages. By combining it with other background properties, you can control how images appear and behave, resulting in professional and modern designs.</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-background-image/">CSS Background Image</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://html5andcss3.org/tutorials/css/css-background-image/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CSS Background Color</title>
		<link>https://html5andcss3.org/tutorials/css/css-background-color/</link>
					<comments>https://html5andcss3.org/tutorials/css/css-background-color/#respond</comments>
		
		<dc:creator><![CDATA[Swapnil Raja]]></dc:creator>
		<pubDate>Wed, 01 Apr 2026 14:17:37 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Colors & Backgrounds]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://html5andcss3.org/?p=3615</guid>

					<description><![CDATA[<p>The CSS Background Color property is used to set the background color of an HTML element. It helps improve the visual appearance of a webpage and can be applied to elements like: Using background colors effectively enhances readability and design layout. 👉 This sets the background color of the entire page. Attributes Property Description Example [&#8230;]</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-background-color/">CSS Background Color</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>The <strong>CSS Background Color</strong> property is used to set the <strong>background color of an HTML element</strong>.</p>
</blockquote>



<p>It helps improve the visual appearance of a webpage and can be applied to elements like:</p>



<ul class="wp-block-list">
<li>Body</li>



<li>Headings</li>



<li>Paragraphs</li>



<li>Div containers</li>
</ul>



<p>Using background colors effectively enhances <strong>readability and design layout</strong>.</p>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Syntax</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.css"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-css">selector {
    background-color: value;
}</code></pre></div>

<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.css"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-css">body {
   background-color: lightblue;
}</code></pre></div>


<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> This sets the background color of the entire page.</p>



<h3 class="wp-block-heading">Attributes</h3>



<figure class="wp-block-table"><table class="has-fixed-layout" style="border-width:1px"><thead><tr><th>Property</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>background-color</td><td>Sets background color</td><td>background-color: yellow;</td></tr><tr><td>color</td><td>Sets text color</td><td>color: black;</td></tr><tr><td>border</td><td>Adds border to element</td><td>border: 1px solid black;</td></tr><tr><td>padding</td><td>Adds inner spacing</td><td>padding: 10px;</td></tr></tbody></table></figure>



<h2 class="wp-block-heading">Example</h2>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Complete Background Color Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button><button class="cbe-try-it-btn" data-language="html">Try It</button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;CSS Background Color&lt;/title&gt;
    &lt;style&gt;
        body {
            background-color: lightgray;
        }
        h1 {
            background-color: lightblue;
            color: black;
        }
        p {
            background-color: yellow;
        }
        div {
            background-color: pink;
            padding: 10px;
            border: 1px solid black;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;h1&gt;Background Color Example&lt;/h1&gt;
    &lt;p&gt;This paragraph has a yellow background.&lt;/p&gt;
    &lt;div&gt;This is a div with pink background.&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre></div>


<h2 class="wp-block-heading">Output</h2>



<h3 class="wp-block-heading">Browser Output</h3>



<pre class="wp-block-preformatted">The page will have a light gray background<br>The heading will have a light blue background<br>The paragraph will have a yellow background<br>The div will have a pink background with border and padding</pre>



<h3 class="wp-block-heading">Browser Support</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/chrome.webp" alt="Chrome" width="32"><br>Chrome</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/firefox.webp" alt="Firefox" width="32"><br>Firefox</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/edge.webp" alt="Edge" width="32"><br>Edge</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/safari.webp" alt="Safari" width="32"><br>Safari</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/opera.webp" alt="Opera" width="32"><br>Opera</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/internet.webp" alt="IE" width="32"><br>IE9+</th></tr><tr><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td></tr></tbody></table></figure>



<p></p>



<h2 class="wp-block-heading">Notes</h2>



<ul class="wp-block-list">
<li>Use <code>background-color</code> to set solid background colors</li>



<li>Can use color formats like <strong>name, HEX, RGB</strong></li>



<li>Helps improve contrast and readability</li>



<li>Avoid using very bright or clashing colors</li>



<li>Combine with text color for better accessibility</li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p>The CSS Background Color property is essential for designing visually appealing web pages. It allows you to highlight sections, improve readability, and create a structured layout using colors effectively.</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-background-color/">CSS Background Color</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://html5andcss3.org/tutorials/css/css-background-color/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CSS RGB Colors</title>
		<link>https://html5andcss3.org/tutorials/css/css-rgb-colors/</link>
					<comments>https://html5andcss3.org/tutorials/css/css-rgb-colors/#respond</comments>
		
		<dc:creator><![CDATA[Swapnil Raja]]></dc:creator>
		<pubDate>Wed, 01 Apr 2026 14:05:17 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Colors & Backgrounds]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://html5andcss3.org/?p=3609</guid>

					<description><![CDATA[<p>RGB colors in CSS are used to define colors using the Red, Green, and Blue color model. Each color value ranges from 0 to 255, where: The combination of these three values creates a wide range of colors. For example: 👉 This sets the text color to red using RGB format. Attributes Property Description Example [&#8230;]</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-rgb-colors/">CSS RGB Colors</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>RGB colors in CSS are used to define colors using the <strong>Red, Green, and Blue</strong> color model.</p>
</blockquote>



<p>Each color value ranges from <strong>0 to 255</strong>, where:</p>



<ul class="wp-block-list">
<li><code>0</code> means no intensity</li>



<li><code>255</code> means full intensity</li>
</ul>



<p>The combination of these three values creates a wide range of colors.</p>



<p>For example:</p>



<ul class="wp-block-list">
<li><code>rgb(255, 0, 0)</code> → Red</li>



<li><code>rgb(0, 255, 0)</code> → Green</li>



<li><code>rgb(0, 0, 255)</code> → Blue</li>
</ul>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Syntax</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">selector {
    color: rgb(red, green, blue);
}</code></pre></div>

<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">p {<br>color: rgb(255, 0, 0);<br>}</code></pre></div>


<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> This sets the text color to red using RGB format.</p>



<h3 class="wp-block-heading">Attributes</h3>



<figure class="wp-block-table"><table class="has-fixed-layout" style="border-width:1px"><thead><tr><th>Property</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>color</td><td>Sets text color</td><td>color: rgb(0, 0, 255);</td></tr><tr><td>background-color</td><td>Sets background color</td><td>background-color: rgb(240, 240, 240);</td></tr><tr><td>border-color</td><td>Sets border color</td><td>border-color: rgb(255, 0, 0);</td></tr><tr><td>outline-color</td><td>Sets outline color</td><td>outline-color: rgb(0, 255, 0);</td></tr></tbody></table></figure>



<h2 class="wp-block-heading">Example</h2>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Complete CSS RGB Color Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button><button class="cbe-try-it-btn" data-language="html">Try It</button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;CSS RGB Colors&lt;/title&gt;
    &lt;style&gt;
        body {
            background-color: rgb(240, 240, 240);
        }
        h1 {
            color: rgb(0, 0, 255);
        }
        p {
            color: rgb(0, 128, 0);
        }
        div {
            border: 2px solid rgb(255, 0, 0);
            padding: 10px;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;h1&gt;RGB Color Example&lt;/h1&gt;
    &lt;p&gt;This paragraph uses RGB color.&lt;/p&gt;
    &lt;div&gt;This box has a red border using RGB.&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre></div>


<h2 class="wp-block-heading">Output</h2>



<h3 class="wp-block-heading">Browser Output</h3>



<pre class="wp-block-preformatted">The page will have a light gray background<br>The heading will appear in blue (rgb(0, 0, 255))<br>The paragraph will appear in green (rgb(0, 128, 0))<br>The box will have a red border (rgb(255, 0, 0))</pre>



<h3 class="wp-block-heading">Browser Support</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/chrome.webp" alt="Chrome" width="32"><br>Chrome</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/firefox.webp" alt="Firefox" width="32"><br>Firefox</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/edge.webp" alt="Edge" width="32"><br>Edge</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/safari.webp" alt="Safari" width="32"><br>Safari</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/opera.webp" alt="Opera" width="32"><br>Opera</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/internet.webp" alt="IE" width="32"><br>IE9+</th></tr><tr><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td></tr></tbody></table></figure>



<p></p>



<h2 class="wp-block-heading">Notes</h2>



<ul class="wp-block-list">
<li>RGB values range from <strong>0 to 255</strong> Allows precise control over colors</li>



<li>You can also use <strong>rgba()</strong> to add transparency <em><code>Example: rgba(255, 0, 0, 0.5)</code></em></li>



<li>Easier to adjust colors dynamically compared to HEX</li>



<li>Widely supported across all browsers</li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p>RGB colors offer a flexible and powerful way to define colors in CSS. With precise control over red, green, and blue values, developers can create a wide variety of colors and even add transparency for modern web designs.</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-rgb-colors/">CSS RGB Colors</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://html5andcss3.org/tutorials/css/css-rgb-colors/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CSS HEX Colors</title>
		<link>https://html5andcss3.org/tutorials/css/css-hex-colors/</link>
					<comments>https://html5andcss3.org/tutorials/css/css-hex-colors/#respond</comments>
		
		<dc:creator><![CDATA[Swapnil Raja]]></dc:creator>
		<pubDate>Wed, 01 Apr 2026 13:51:18 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Colors & Backgrounds]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://html5andcss3.org/?p=3607</guid>

					<description><![CDATA[<p>HEX (Hexadecimal) colors are a popular way to define colors in CSS using a 6-digit combination of numbers and letters. A HEX color starts with a hash (#) followed by values representing Red, Green, and Blue (RGB). Each pair controls the intensity of a color: For example: 👉 This sets the text color to red [&#8230;]</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-hex-colors/">CSS HEX Colors</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>HEX (Hexadecimal) colors are a popular way to define colors in CSS using a <strong>6-digit combination of numbers and letters</strong>.</p>
</blockquote>



<p>A HEX color starts with a <strong>hash (<code>#</code>)</strong> followed by values representing <strong>Red, Green, and Blue (RGB)</strong>.</p>



<p>Each pair controls the intensity of a color:</p>



<ul class="wp-block-list">
<li><code>#RRGGBB</code></li>
</ul>



<p>For example:</p>



<ul class="wp-block-list">
<li><code>#FF0000</code> → Red</li>



<li><code>#00FF00</code> → Green</li>



<li><code>#0000FF</code> → Blue</li>
</ul>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Syntax</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">selector {
    color: #RRGGBB;
}</code></pre></div>

<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">p {
color: #ff0000;
}</code></pre></div>


<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> This sets the text color to red using HEX value.</p>



<h3 class="wp-block-heading">Attributes</h3>



<figure class="wp-block-table"><table class="has-fixed-layout" style="border-width:1px"><thead><tr><th>Property</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>color</td><td>Sets text color</td><td>color: #0000ff;</td></tr><tr><td>background-color</td><td>Sets background color</td><td>background-color: #f0f0f0;</td></tr><tr><td>border-color</td><td>Sets border color</td><td>border-color: #ff0000;</td></tr><tr><td>outline-color</td><td>Sets outline color</td><td>outline-color: #00ff00;</td></tr></tbody></table></figure>



<h2 class="wp-block-heading">Example</h2>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">CSS Hex Colors Complete Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button><button class="cbe-try-it-btn" data-language="html">Try It</button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;CSS HEX Colors&lt;/title&gt;
    &lt;style&gt;
        body {
            background-color: #f2f2f2;
        }

        h1 {
            color: #0000ff;
        }

        p {
            color: #008000;
        }

        div {
            border: 2px solid #ff0000;
            padding: 10px;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;h1&gt;HEX Color Example&lt;/h1&gt;

    &lt;p&gt;This paragraph uses HEX color.&lt;/p&gt;

    &lt;div&gt;This box has a red border using HEX.&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre></div>


<h2 class="wp-block-heading">Output</h2>



<h3 class="wp-block-heading">Browser Output</h3>



<pre class="wp-block-preformatted">The page will have a light gray background<br>The heading will appear in blue (#0000ff)<br>The paragraph will appear in green (#008000)<br>The box will have a red border (#ff0000)</pre>



<h3 class="wp-block-heading">Browser Support</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/chrome.webp" alt="Chrome" width="32"><br>Chrome</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/firefox.webp" alt="Firefox" width="32"><br>Firefox</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/edge.webp" alt="Edge" width="32"><br>Edge</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/safari.webp" alt="Safari" width="32"><br>Safari</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/opera.webp" alt="Opera" width="32"><br>Opera</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/internet.webp" alt="IE" width="32"><br>IE9+</th></tr><tr><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td></tr></tbody></table></figure>



<p></p>



<h2 class="wp-block-heading">Notes</h2>



<ul class="wp-block-list">
<li>HEX values range from <strong>00 to FF</strong> (0–255 in decimal)</li>



<li>You can use shorthand HEX values like <code>#fff</code> (for <code>#ffffff</code>)</li>



<li>HEX is widely used in web design for precise color control</li>



<li>Case-insensitive (<code>#FF0000</code> = <code>#ff0000</code>)</li>



<li>Easy to copy and reuse across projects</li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p>HEX colors provide a precise and widely accepted way to define colors in CSS. They are essential for consistent and professional web design, allowing developers to control colors accurately across different elements.</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-hex-colors/">CSS HEX Colors</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://html5andcss3.org/tutorials/css/css-hex-colors/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CSS Colors</title>
		<link>https://html5andcss3.org/tutorials/css/css-colors/</link>
					<comments>https://html5andcss3.org/tutorials/css/css-colors/#respond</comments>
		
		<dc:creator><![CDATA[Swapnil Raja]]></dc:creator>
		<pubDate>Wed, 01 Apr 2026 13:44:24 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Colors & Backgrounds]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://html5andcss3.org/?p=3605</guid>

					<description><![CDATA[<p>CSS Colors are used to define the color of text, backgrounds, borders, and other elements on a webpage. Colors play a very important role in web design as they improve visual appearance, readability, and user experience. In CSS, colors can be applied using different formats such as: 👉 This sets the text color of all [&#8230;]</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-colors/">CSS Colors</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>CSS Colors are used to define the <strong>color of text, backgrounds, borders, and other elements</strong> on a webpage.</p>
</blockquote>



<p>Colors play a very important role in web design as they improve <strong>visual appearance, readability, and user experience</strong>.</p>



<p>In CSS, colors can be applied using different formats such as:</p>



<ul class="wp-block-list">
<li>Color names (e.g., red, blue)</li>



<li>HEX values</li>



<li>RGB values</li>
</ul>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">CSS Colors Syntax</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">selector {
    color: value;
}</code></pre></div>

<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">CSS Colors Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">p {
color: red;
}</code></pre></div>


<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> This sets the text color of all <code>&lt;p></code> elements to red.</p>



<h3 class="wp-block-heading">Attributes</h3>



<figure class="wp-block-table"><table class="has-fixed-layout" style="border-width:1px"><thead><tr><th>Property</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>color</td><td>Sets text color</td><td>color: blue;</td></tr><tr><td>background-color</td><td>Sets background color</td><td>background-color: yellow;</td></tr><tr><td>border-color</td><td>Sets border color</td><td>border-color: black;</td></tr><tr><td>outline-color</td><td>Sets outline color</td><td>outline-color: red;</td></tr></tbody></table></figure>



<h2 class="wp-block-heading">Example</h2>


<div class="cbe-code-block-wrapper"><div class="cbe-header-buttons-wrapper"><div class="cbe-header-text">CSS Colors Complete Example</div><div class="cbe-buttons"><button class="cbe-copy-btn"><i class="eicon-copy"></i></button><button class="cbe-download-btn" data-filename="code.html"><i class="eicon-download-bold"></i></button><button class="cbe-try-it-btn" data-language="html">Try It</button></div></div><pre class="wp-block-code line-numbers"><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;CSS Colors Example&lt;/title&gt;
    &lt;style&gt;
        body {
            background-color: lightgray;
        }

        h1 {
            color: blue;
        }

        p {
            color: green;
        }

        div {
            border: 2px solid red;
            padding: 10px;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;h1&gt;CSS Colors&lt;/h1&gt;

    &lt;p&gt;This is a paragraph with green text.&lt;/p&gt;

    &lt;div&gt;This box has a red border.&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre></div>


<h2 class="wp-block-heading">Output</h2>



<h3 class="wp-block-heading">Browser Output</h3>



<pre class="wp-block-preformatted">The page will have a light gray background<br>The heading will appear in blue color<br>The paragraph will appear in green color<br>The box will have a red border</pre>



<h3 class="wp-block-heading">Browser Support</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/chrome.webp" alt="Chrome" width="32"><br>Chrome</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/firefox.webp" alt="Firefox" width="32"><br>Firefox</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/edge.webp" alt="Edge" width="32"><br>Edge</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/safari.webp" alt="Safari" width="32"><br>Safari</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/opera.webp" alt="Opera" width="32"><br>Opera</th><th class="has-text-align-center" data-align="center"><img decoding="async" src="https://html5andcss3.org/wp-content/uploads/2025/10/internet.webp" alt="IE" width="32"><br>IE9+</th></tr><tr><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td><td class="has-text-align-center" data-align="center"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" />Yes</td></tr></tbody></table></figure>



<p></p>



<h2 class="wp-block-heading">Notes</h2>



<ul class="wp-block-list">
<li>CSS supports multiple color formats (name, HEX, RGB)</li>



<li>Use <code>color</code> for text and <code>background-color</code> for backgrounds</li>



<li>Choose colors carefully for <strong>better readability and accessibility</strong></li>



<li>Avoid using too many colors to keep design clean</li>



<li>Use consistent color schemes for better UI/UX</li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p>CSS Colors are essential for making web pages visually appealing and user-friendly. By using different color properties, you can enhance design, highlight important elements, and improve the overall user experience.</p>
<p>The post <a href="https://html5andcss3.org/tutorials/css/css-colors/">CSS Colors</a> appeared first on <a href="https://html5andcss3.org">HTML5 &amp; CSS3</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://html5andcss3.org/tutorials/css/css-colors/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>