Liquid layout example (responsive design)

When a layout of a web page is set as liquid, then the html objects on the web page adjust their position and size to fit themselves on the visible portion of screen. The liquid layouts are also known as responsive designs, and are best when the page is also need to be opened on mobile devices with smaller screen or tablets.

The key difference between fixed layout and liquid layout is that in defining liquid layout, we do not use pixels “px” units, rather we user percentages or “em” units for measurements.

The following is a complete example of liquid layout:

<!DOCTYPE html>
<html>
<head>
    <title></title>
  <meta charset="utf-8" />

    <style>
        body
        {
            width: 90%;
            margin:0 auto;
        }

        #content
        {
            overflow: auto;
        }

        #nav, #feature, #footer
        {
         margin:1%;
        }

        .column1, .column2, .column3
        {
            width:31.3%;
            float:left;
            margin:1%;
        }

        .column3
        {
            margin-right: 0%;
        }
        
        li
        {
            display:inline;
            padding: 0.5em;
        }

        #nav, #footer
        {
            background-color:#efefef;
           padding: 0.5em 0;
        }

        #feature, .article
        {
            height: 10em;
            margin-bottom: 1em;
            background-color: #efefef;

        }
    </style>
</head>
<body>
    <div id="header">
        <h1>Logo</h1>
        <div id="nav">
            <ul>
                <li><a href="">Home</a></li>
                <li><a href="">Products</a></li>
                <li><a href="">Services</a></li>
                <li><a href="">About</a></li>
                <li><a href="">Contact</a></li>
            </ul>
        </div>
    </div>

    <div id="content">
        <div id="feature">
            <p>Feature</p>
            <p>This is feature text.  
            <img src="images/banner.gif" width="50%" />
            </p>
        </div>
        <div class="article column1">
            <p>Column One</p>
            <p>Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document. To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries. Themes and styles also help keep your document coordinated. When you click Design and choose a new Theme, the pictures, charts, and SmartArt graphics change to match your new theme. When you apply styles, your headings change to match the new theme. Save time in Word with new buttons that show up where you need them. Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document. To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries. Themes and styles also help keep your document coordinated. When you click Design and choose a new Theme, the pictures, charts, and SmartArt graphics change to match your new theme. When you apply styles, your headings change to match the new theme. Save time in Word with new buttons that show up where you need them.</p>
        </div>

        <div class="article column2">
            <p>Column Two</p>
            <p>
                Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document. To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries. Themes and styles also help keep your document coordinated. When you click Design and choose a new Theme, the pictures, charts, and SmartArt graphics change to match your new theme. When you apply styles, your headings change to match the new theme. Save time in Word with new buttons that show up where you need them.
            </p>
        </div>

        <div class="article column3">
            <p>Column Three</p>
            <p>
                Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document. To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries. Themes and styles also help keep your document coordinated. When you click Design and choose a new Theme, the pictures, charts, and SmartArt graphics change to match your new theme. When you apply styles, your headings change to match the new theme. Save time in Word with new buttons that show up where you need them.
            </p>
        </div>

    </div>

    <div id="footer">
        <p>&copy; Copyright 2017</p>
    </div>
</body>
</html>

 

Add a Comment

Your email address will not be published. Required fields are marked *