<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shashank Lakhotia on Medium]]></title>
        <description><![CDATA[Stories by Shashank Lakhotia on Medium]]></description>
        <link>https://medium.com/@shashanklakhotia?source=rss-b038b227fd39------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*GR1WxElakwgIYCj1.</url>
            <title>Stories by Shashank Lakhotia on Medium</title>
            <link>https://medium.com/@shashanklakhotia?source=rss-b038b227fd39------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 02:58:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shashanklakhotia/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Responsive Web Design — RWD]]></title>
            <link>https://medium.com/@shashanklakhotia/responsive-web-design-rwd-55ad5c0f9e72?source=rss-b038b227fd39------2</link>
            <guid isPermaLink="false">https://medium.com/p/55ad5c0f9e72</guid>
            <category><![CDATA[screen-resolution]]></category>
            <category><![CDATA[responsive-design]]></category>
            <category><![CDATA[css3]]></category>
            <category><![CDATA[media-queries]]></category>
            <category><![CDATA[rwd]]></category>
            <dc:creator><![CDATA[Shashank Lakhotia]]></dc:creator>
            <pubDate>Fri, 21 Sep 2018 09:39:30 GMT</pubDate>
            <atom:updated>2018-09-24T09:56:57.601Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>What is Responsive Web Design?<br></strong>In our current web world, websites are not only being browsed using a variety of devices having different screen sizes, but the same visitors are returning to the same websites using different devices as well. <br>So for providing the best user experience and accessibility of the websites to the users, our sites/web apps must work well regardless of which device they may be using at a given time. Responsive Web Design is what you need to combat such situations as it makes your web pages look good across all standard devices.<br> <br>Using the RWD technique websites/web apps use the same URL across the devices (e.g. Desktop, Tablet, Mobile phones etc.) in order to render the content by adjusting the designs automatically suitable to the type of device.<br> <br>The design will respond to the various screen size of the device intelligently to cater the content to the users. Thus a Responsive Web Design is mostly a Client side Rendering based on the specification of various available devices in the market.</blockquote><p><strong>Responsive Web Design works on below considerations:</strong></p><p><strong>The fluid grid concept:<br></strong>The Layout for RWD should be fluid considering the various screen size/devices in the market.<br>We have various devices having different screen resolution and viewports available (and still upgrading) for the users in the market. Considering this fact we need to have a common solution which doesn’t hamper user’s experience to view the website/web apps on their device. So to combat this challenge the Fluid Grid concept exactly what one can bank on.</p><p>If we target only for the desktop version, the layout doesn’t need to be fluid. i.e. Values in <strong><em>px </em></strong>is all what one can focus on.</p><p>The best way to make layouts fluid is to use relative units like “<strong><em>%</em></strong>” or “<em>em</em>”instead of absolute units like “pt” &amp; “<em>px”</em>.</p><blockquote><strong>Flexible images concept:</strong><br>The images should also be sized in relative units, so as to prevent them from displaying outside their containing elements. Thus the images would be visible sharp without disturbing the layout and it will complement the device resolution and Viewport.<br><strong>e.g.</strong><br><em>img {<br>max-width: 100%;<br>height: auto;<br>}</em></blockquote><p>In above example the<em> img</em> tag has been set with the attribute <em>max-width: 100%</em> so that the image should not be scaled more than it’s original width and should be scaled down based on the resolution of the devices whenever necessary.<br> <br><strong>CSS3 Media queries:</strong><br>Media queries have been one of most powerful considerations that allows the page to use different CSS style rules based on characteristics of the device the site is being displayed on, most commonly the width of the browser. <br> <br><strong>Breakpoints:<br></strong>Breakpoints basically come into the picture when a web page is not looking good beyond a specific screen/device resolution. <br>Accordingly we need to manipulate the alignment of the layout and their respective content so that a user should see/read the content without having to zoom in/out and without having to display horizontal scrolls on the devices they use.</p><p><strong>Demonstration:</strong><br>Let’s take an example of the Responsive grid Layout which we will be targeting for Desktop, Tablets and Mobile phones.</p><p>Our intention would be to serve two different designs common for Mobile phones &amp; Tablets but would be setting a layout breakpoints for Desktops to serve the new layout based on the Device Screen Resolution to serve the purpose.</p><p>The requirement of different deign (breakpoints specific) for devices mostly should be identified based on the accessibility to its users along with device compatibility and not based on just for the sake of design change w.r.t devices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8xgzruN0uWfej16HywHcXw.png" /><figcaption><strong>Figure:1 - Desktop Resolution 1600px*900px</strong></figcaption></figure><p><strong>Figure: 1</strong> is a snapshot of <strong>Desktop version</strong> of the layout where you can see the “Section” &amp; “Aside” containers floated in-line to each other in response to the desktop screen resolution of 1600px.</p><p>All the three rows have been wrapped with the <em>container </em>div and the widths have been set in “%”. It is beneficial in RWD as this will proportionality increase/decrease the divs across the devices having various resolutions.</p><p>The first container with width 100% is holding two containers as <em>section</em> &amp; <em>aside</em> out of which <em>section</em> is floated to the left and <em>aside</em> on right with their respective widths in “%”.</p><p>Likewise the second and third row containers have the <em>width:75%</em> &amp; <em>width:50%</em> respectively holding their respective section &amp; aside.<br>So as widths of containers and their children tags have been put in “%”, they adjust themselves according to their parent containers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*03E5zLx9ZHihHumEDpgXLg.png" /><figcaption><strong>Figure:2 — Tablet Version 1024x768 Resolution</strong></figcaption></figure><p>For devices like Tablets &amp; Mobile phones we need to set the device Viewport properties in the head in the meta tag as below:</p><p><strong><em>&lt;meta name=”viewport” content=”width=device-width, initial-scale=1.0&quot;&gt;</em></strong></p><p>The width property above handles the size of the viewport. It can be set to a specific number of pixels <em>e.g. width=600</em> or to the device-width value which is the width of the screen in CSS pixels at a scale of 100%.</p><p>There are corresponding height and device-height values, which may be useful for pages with elements that change size or position based on the device viewport height.</p><p>The <em>initial-scale=1.0 </em>sets the zoom level as soon as the page first loads on the browser on device.</p><p><strong>Figure 2</strong> above is the Tablet version of the layout using the same set of html code. As you cam see, the <em>Section</em> &amp; <em>Aside</em> containers have been shifted to another row in contrast to what is being shown on <strong>Figure 1</strong> above for Desktop Version.<br> <br>The idea here is to show a different page layout having same content due to the screen size the Tablets offer to the users so that the browsing experience should not be hampered to the end users due to difference in device capabilities.</p><p>For this design we have set the layout <strong>breakpoint</strong> as <em>max-width: 1024px</em> so that the desktop version layout breaks into the one in shown in <strong>Figure 2</strong> above especially if the page is accessed using the tablet having the screen resolution of <em>1024px</em> or less.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DxX--kalWqQgytMl0FI-rQ.png" /><figcaption><strong>Figure: 3 - Mobile Version 360x640 Resolution</strong></figcaption></figure><p>In above screen <strong>Figure: 3</strong> the Mobile Version of the page is displayed. <br>The mobile Screen resolution is 360x640. <br>As you can see how intelligently the same layout has been shrunk to fit within the Mobile Screen.</p><p>It still applies the min-width media query which is being used for tablet as the resolution of the mobile screen is within the targeted breakpoint of the width 1024px.</p><p>So any Smartphone /device falling within this screen resolution would render the same layout to auto shrink the containers based on the device viewport.</p><p>There are many other considerations one needs to take into account while creating RWD based on the requirement and device types to support.</p><blockquote><strong>HTML Code for above implementations:</strong></blockquote><blockquote><em>&lt;!DOCTYPE html&gt;</em></blockquote><blockquote><em>&lt;html&gt;</em></blockquote><blockquote><em>&lt;title&gt;Responsive HTML Tutorial&lt;/title&gt;</em></blockquote><blockquote><em>&lt;meta name=”viewport” content=”width=device-width, initial-scale=1.0&quot;&gt;</em></blockquote><blockquote><em>&lt;head&gt;<br> &lt;style&gt;<br> body {</em></blockquote><blockquote><em>font: 600 14px/24px “Open Sans”, “HelveticaNeue-Light”, “Helvetica Neue Light”, Sans-Serif;</em></blockquote><blockquote><em>}</em></blockquote><blockquote><em>h1 {</em></blockquote><blockquote><em>color: #9799a7;</em></blockquote><blockquote><em>font-size: 14px;</em></blockquote><blockquote><em>font-weight: bold;</em></blockquote><blockquote><em>margin-bottom: 6px;</em></blockquote><blockquote><em>}</em></blockquote><blockquote><em>.container {</em></blockquote><blockquote><em>margin-bottom: 24px;</em></blockquote><blockquote><em>*zoom: 1;</em></blockquote><blockquote><em>}</em></blockquote><blockquote><em>.container-75 {</em></blockquote><blockquote><em>width: 75%;</em></blockquote><blockquote><em>}</em></blockquote><blockquote><em>.container-50 {</em></blockquote><blockquote><em>margin-bottom: 0;</em></blockquote><blockquote><em>width: 50%;</em></blockquote><blockquote><em>}</em></blockquote><blockquote><em>.container,</em></blockquote><blockquote><em>section,</em></blockquote><blockquote><em>aside {</em></blockquote><blockquote><em>border-radius: 6px;</em></blockquote><blockquote><em>}</em></blockquote><blockquote><em>section,</em></blockquote><blockquote><em>aside {</em></blockquote><blockquote><em>background: #2db34a;</em></blockquote><blockquote><em>color: #fff;</em></blockquote><blockquote><em>margin: 1.8%;</em></blockquote><blockquote><em>padding: 20px 0;</em></blockquote><blockquote><em>text-align: center;</em></blockquote><blockquote><em>}</em></blockquote><blockquote><em>section {</em></blockquote><blockquote><em>float: left;</em></blockquote><blockquote><em>width: 63.19%;</em></blockquote><blockquote><em>}</em></blockquote><blockquote><em>aside {</em></blockquote><blockquote><em>float: right;</em></blockquote><blockquote><em>width: 29.3%;</em></blockquote><blockquote><em>}<br> &lt;/style&gt;</em></blockquote><blockquote><em>&lt;body&gt;</em></blockquote><blockquote><em>&lt;h1&gt;Container with 100% of Width&lt;/h1&gt;</em></blockquote><blockquote><em>&lt;div class=”container”&gt;</em></blockquote><blockquote><em>&lt;section&gt;Section&lt;/section&gt;</em></blockquote><blockquote><em>&lt;aside&gt;Aside&lt;/aside&gt;</em></blockquote><blockquote><em>&lt;/div&gt;</em></blockquote><blockquote><em>&lt;h1&gt;Container with 75% of Width&lt;/h1&gt;</em></blockquote><blockquote><em>&lt;div class=”container container-75&quot;&gt;</em></blockquote><blockquote><em>&lt;section&gt;Section&lt;/section&gt;</em></blockquote><blockquote><em>&lt;aside&gt;Aside&lt;/aside&gt;</em></blockquote><blockquote><em>&lt;/div&gt;</em></blockquote><blockquote><em>&lt;h1&gt;Container with 50% of Width&lt;/h1&gt;</em></blockquote><blockquote><em>&lt;div class=”container container-50&quot;&gt;</em></blockquote><blockquote><em>&lt;section&gt;Section&lt;/section&gt;</em></blockquote><blockquote><em>&lt;aside&gt;Aside&lt;/aside&gt;</em></blockquote><blockquote><em>&lt;/div&gt;</em></blockquote><blockquote><em>&lt;/body&gt;</em></blockquote><blockquote><em>&lt;/html&gt;</em></blockquote><p><strong>Responsive Images:<br></strong>Apart from the layouts we built above, there are many components (e.g. Form components, Images, iframes etc.) on a webpage that we need to code in a way so as to make them respond based on the device screen and which should complement its respective layout.</p><p>Let’s talk about one of such components i.e. <strong>Images</strong>. Images play one of the major roles on a webpage for its users to attract and to describe its content. These alaso need to be rendering well on all the devices that users may want to browser the webpage from.</p><p><strong>Demonstration:<br></strong>Lets insert an image within <strong>Aside</strong> section of the <em>container with 75% of width </em>as below.</p><blockquote><strong>HTML code:</strong><br><em>&lt;h1&gt;Container with 75% of Width&lt;/h1&gt;<br>&lt;div class=”container container-75&quot;&gt;<br>&lt;section&gt;Section&lt;/section&gt;<br></em><strong><em>&lt;aside&gt;Aside&lt;img src=”img/nature.jpg”&gt;&lt;/aside&gt;</em></strong><em><br>&lt;/div&gt;</em></blockquote><blockquote><strong>CSS Code:<br></strong><em>img { <br> max-width: 97%;<br> height: auto;<br> }</em></blockquote><p>In order to make images respond relative to the screen size, <strong><em>max-width </em></strong>CSS attribute is required to set on img tag with <strong><em>height</em></strong><em>:</em><strong><em>auto </em></strong>property. <br><strong><em>max-width</em></strong>:<strong>97%</strong> will stretch the image width horizontally till 97% to it’s container width relatively. I have deliberately taken 97% value instead of 100% so as to show some spaces around the box.<br><strong><em>height</em></strong><em>:</em><strong><em>auto </em></strong>will help keeping the image height proportionate with width.<br> <br><strong>Note:</strong> I have applied these attributes globally on the <strong>img</strong> tag as I am showing only one image but you can certainly define a <strong>class/id </strong>to apply the same on. You need to decide on this based on the feasibility of your web content as this is going to impact every single <strong>img </strong>tag on a webpage that you may/may not want to apply these properties on.</p><p>This is all what you need to make images responsive across devices.</p><blockquote><strong>Below are the outputs showing the rendering of image across the devices.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c2GC0T9iBh9z57MZUlGu7Q.png" /><figcaption><strong>Desktop Resolution 1600px*900px</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*5IDiN1tLosCY1w_djfrAug.png" /><figcaption><strong>Tablet Resolution 1024px*768px</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/407/1*lnKb1Q0Tv1r0cxmAalSE-g.png" /><figcaption><strong>Mobile Version 360x640 Resolution</strong></figcaption></figure><blockquote><strong>Table below shows the screen resolutions and CSS media device dimensions of some of the popular devices available for users in the market.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*aywws0PFhPMcN_M8x1PFDg.jpeg" /><figcaption><strong>CSS Media Dimensions for Standard Devices</strong></figcaption></figure><p>Cheers!!<br>Shashank Lakhotia</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55ad5c0f9e72" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>