Google Ads

Month: May 2018

Learn Responsive Text Size – HTML Code

The text size can be set with a “vw” unit, which means the “viewport width”.

That way the text size will follow the size of the browser window:



<h1 style="font-size:10vw;">Responsive Text</h1>


Try Your Self ->


Learn HTML Responsive Web Design Show Different Images Depending on Browser Width

The HTML <picture> element allows you to define different images for different browser window sizes.

Resize the browser window to see how the image below change depending on the width:



<source srcset="img_smallflower.jpg" media="(max-width: 600px)">
<source srcset="img_flowers.jpg" media="(max-width: 1500px)">
<source srcset="flowers.jpg">
<img src="img_flowers.jpg" alt="Flowers" style="width:auto;">


Try Your Self ->


Learn Responsive Images Using the max-width Property – HTML Code

Notice that in the example above, the image can be scaled up to be larger than its original size. A better solution, in many cases, will be to use the max-width property instead.

Using the max-width Property

If the max-width property is set to 100%, the image will scale down if it has to, but never scale up to be larger than its original size:



<img src="img_girl.jpg" style="max-width:100%;height:auto;">


Try Your Self ->


Learn Responsive Images Using the width Property – HTML Code

Responsive images are images that scale nicely to fit any browser size.

Using the width Property

If the CSS width property is set to 100%, the image will be responsive and scale up and down:



<img src="img_girl.jpg" style="width:100%;">


Try Your Self ->


Learn Setting The Viewport – HTML Code

When making responsive web pages, add the following <meta> element in all your web pages:



<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">


Try Your Self ->


Learn HTML Responsive Web Design – HTML

What is Responsive ?

Here is a picture example.



Try Your Self ->


Learn CSS Flexbox HTML Layout – HTML Code

Flexbox is a new layout mode in CSS3.

Use of flexbox ensures that elements behave predictably when the page layout must accommodate different screen sizes and different display devices. Disadvantages: Does not work in IE10 and earlier.

Learn more about flexbox in our CSS Flexbox chapter.


Try Your Self ->


Learn CSS Floats HTML Layout – HTML Code

It is common to do entire web layouts using the CSS float property. Float is easy to learn – you just need to remember how the float and clear properties work. Disadvantages: Floating elements are tied to the document flow, which may harm the flexibility. Learn more about float in our CSS Float and Clear chapter.


Try Your Self ->


Learn HTML Layout Elements – HTML Code

Websites often display content in multiple columns (like a magazine or newspaper).

HTML5 offers new semantic elements that define the different parts of a web page:


Learn HTML Layout Example – HTML Code



<div class="container">

<h1>City Gallery</h1>

<li><a href="#">London</a></li>
<li><a href="#">Paris</a></li>
<li><a href="#">Tokyo</a></li>

<p>London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants.</p>
<p>Standing on the River Thames, London has been a major settlement for two millennia, its history going back to its founding by the Romans, who named it Londinium.</p>


Try Your Self ->