Note that there are some explanatory texts on larger screens.

plurals
  1. POA better workflow for a responsive web layout using DIV stacking
    primarykey
    data
    text
    <p>I had a requirement to put 2 image within a band on a page and then make it responsive to various screen sizes. So below a and b would represent these images and the band in red. The gap between a and b needed to remain proportional tho a and b were of slightly different width as A was a circular logo and b was a rectangular logo.</p> <p><img src="https://i.stack.imgur.com/Gu7yJ.png" alt="enter image description here"></p> <p>So I got it to work by moving through various screen size and manually adjusted the css according to what I saw using media queries as below:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Welcome&lt;/title&gt; &lt;meta name="description" content="T"&gt; &lt;meta name="keywords" content=""&gt; &lt;meta name="author" content=""&gt; &lt;meta http-equiv="cleartype" content="on"&gt; &lt;!-- Responsive and mobile friendly stuff --&gt; &lt;meta name="HandheldFriendly" content="True"&gt; &lt;meta name="MobileOptimized" content="320"&gt; &lt;meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"&gt; &lt;style type="text/css"&gt; html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } /* HTML5 display-role reset for older browsers */ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } body { line-height: 1; } ol, ul { list-style: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } table { border-collapse: collapse; border-spacing: 0; } html,body { color:#ffffff; margin:0px; padding:0px; background: url('images/bg-1366.jpg') no-repeat center center fixed; -webkit-background-size: cover; /* For WebKit*/ -moz-background-size: cover; /* Mozilla*/ -o-background-size: cover; /* Opera*/ background-size: cover; /* Generic*/ } #band{ position: relative; top:27.5%; height:30%; width:100%; max-width: 100%; border:3px solid #ffffff; border-right-style:none; border-left-style:none; margin:0px; align:center; padding:0px; background-color: #000000; -webkit-background-size: cover; /* For WebKit*/ -moz-background-size: cover; /* Mozilla*/ -o-background-size: cover; /* Opera*/ background-size: cover; /* Generic*/ } #holistic { float:right; max-width: 80%; max-height: 80%; } #spa { float:left; max-width: 90%; max-height: 90%; } #off { float:left; max-width: 1%; max-height: 1%; } &lt;/style&gt; &lt;link rel="stylesheet" href="css/col.css" media="all"&gt; &lt;link rel="stylesheet" href="css/3acols.css" media="all"&gt; &lt;link rel="stylesheet" href="css/media.css" media="all"&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="band"&gt; &lt;div id="wrapper"&gt; &lt;div class="section group"&gt; &lt;div class="col span_1_of_2"&gt; &lt;img id="holistic" src="Ehlogo.png"&gt; &lt;/div&gt; &lt;div class="col coloff span_3_of_2"&gt; &lt;img id="off" src="images/off.png"&gt; &lt;/div&gt; &lt;div class="col span_1_of_2"&gt; &lt;img id="spa" src="ESlogo.png"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; @charset "utf-8"; @media only screen and (min-width : 320px) and (max-width : 480px) { .col{ text-align:center; } #holistic { float: none; max-width: 95%; max-height: 95%; } #spa { float:right; max-width: 95%; max-height: 95%; margin-top:7.5%; margin-right:10%; } #band { top:12.5%; height:30%; } } @media only screen and (min-width : 480px) and (max-width : 640px) and (max-height : 960px){ .col{ text-align:center; width:640px; max-width: 100%; max-height: 100%; } #holistic { float: none; max-width: 85%; max-height: 85%; } #spa { float:right; max-width: 85%; max-height: 85%; margin-top:7.5%; margin-right:10%; } #band { top:12.5%; height:30%; } } @media only screen and (max-width : 480px) and (max-height : 800px){ .col{ text-align:center; } #holistic { float: none; max-width: 95%; max-height: 95%; } #spa { float:none; max-width: 95%; max-height: 95%; margin-right:10%; } } @media only screen and (min-width : 640px) and (max-width : 768px) and (max-height : 1280px){ .col{ text-align:center; width:768px; max-width: 100%; max-height: 100%; } #holistic { float: none; max-width: 100%; max-height: 100%; } #spa { float:none; max-width: 100%; max-height: 100%; margin-top:3.5%; margin-right:3%; } #band { top:12.5%; height:25%; } } @media only screen and (min-width: 1024px) and (max-width: 1280px) { body{ background: url('images/bg-1280.jpg') no-repeat center center fixed; } #holistic { position:relative; top:-5px; left:10px; max-width: 90%; max-height: 90%; } .coloff { width:75px; } #spa { float:right; margin-top:2%; margin-right:15%; max-width: 85%; max-height: 85%; } } @media only screen and (min-width: 1250px) and (max-width: 1366px) and (min-height: 1024px) { body{ background: url('images/bg-1280.jpg') no-repeat center center fixed; } #holistic { max-width: 90%; max-height: 90%; } .coloff { width:75px; } #spa { float:right; margin-top:2%; margin-right:15%; max-width: 85%; max-height: 85%; } #band { top:25%; height:32.5%; } } @media only screen and (min-width: 1280px) and (max-width: 1366px) and (max-height: 799px){ body{ background: url('images/bg-1366.jpg') no-repeat center center fixed; } #holistic { position:relative; top:-16px; max-width: 100%; max-height: 100%; } #spa { max-width: 90%; max-height: 90%; } .coloff { width:165px; } #band { top:25%; height:32.5%; } } @media only screen and (min-width: 1200px) and (max-width: 1279px) and (max-height: 799px){ body{ background: url('images/bg-1366.jpg') no-repeat center center fixed; } #holistic { max-width: 95%; max-height: 90%; } #spa { float:left; max-width: 85%; max-height: 85%; } .coloff { width:175px; } #band { top:25%; height:32.5%; } } @media only screen and (min-width: 1580px) and (max-width: 1920px){ body{ background: url('images/bg-1366.jpg') no-repeat center center fixed; } #holistic { max-width: 90%; max-height: 90%; } #spa { float:left; max-width: 90%; max-height: 90%; } .coloff { width:180px; } #band { top:25%; height:28.5%; } } @media only screen and (min-width: 1920px) and (max-width: 2400px){ body{ background: url('images/bg-1366.jpg') no-repeat center center fixed; } #holistic { position:relative; top:-10px; max-width: 90%; max-height: 90%; } #spa { margin-top:0.5%; float:left; max-width: 86%; max-height: 86%; } .coloff { width:200px; } #band { top:25%; height:30%; } } /* SECTIONS ============================================================================= */ .section { clear: both; padding: 0px; margin: 0px; } /* GROUPING ============================================================================= */ .group:before, .group:after { content:""; display:table; } .group:after { clear:both; } .group { zoom:1; /* For IE 6/7 (trigger hasLayout) */ } /* GRID COLUMN SETUP ==================================================================== */ .col { display: block; float:left; margin: 1% 0 1% 1.6%; } .col:first-child { margin-left: 0; } /* all browsers except IE6 and lower */ /* REMOVE MARGINS AS ALL GO FULL WIDTH AT 480 PIXELS */ @media only screen and (max-width: 480px) { .col { margin: 1% 0 1% 0%; } } /* GRID OF TWO ============================================================================= */ .span_2_of_2 { width: 100%; } .span_3_of_2 { width: 10%; } .span_1_of_2 { width: 40.2%; } /* GO FULL WIDTH AT LESS THAN 480 PIXELS */ @media only screen and (max-width: 480px) { .span_2_of_2 { width: 100%; } .span_1_of_2 { width: 100%; } } </code></pre> <p>My problem is that this was a total pain. It was a lot of guessing and entering % values / saving the file / reloading the browser to see how it looked / adjusting again and so on. Gah! </p> <p>So I'm looking for a way to use math or a framework or some workflow algorithm to speed this up and take all the guess work out of it. My method was purely amateur hour but so far I cant find a better way to go at it when using percentages and media queries. This took me far too long.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload