Skip to content

Instantly share code, notes, and snippets.

@jpsilvashy
Created March 3, 2010 17:19
Show Gist options
  • Save jpsilvashy/320775 to your computer and use it in GitHub Desktop.
Save jpsilvashy/320775 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>css_correct_width</title>
<style type="text/css" media="screen">
/* because all browsers have a differnt opinion on alot of things like what the
* default size of an h1 is, what the default font-famliy is, and many things else,
* we set everything here to make sure that we start on an even playing field across
* all browsers
*/
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, font, 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 {
margin:0; padding:0; border:0; outline:0; font-size:100%; vertical-align:baseline; background:transparent;}
html, body {line-height:1; overflow: visible;}
blockquote, q {quotes:none;}
blockquote:before, blockquote:after, q:before, q:after {content:''; content:none;}
:focus {outline:0;}
ins {text-decoration:none;}
del {text-decoration:line-through;}
tfoot {font-style:italic;}
caption {background:transparent;}
body, blockquote {font:12px/1.5 "Helvetica", "Arial", sans-serif;}
h1, h2, h3, h4 {font-weight:normal;}
p {}
ul {list-style-type:none;}
ol {list-style-type:decimal; overflow:hidden;}
abbr, acronym {border-bottom-width:0;}
strong {font-weight:bold;}
em {font-style:italic;}
#first_div
{
border: solid green;
/* only need overflow this elements child has a float property */
overflow: hidden;
position:relative;
}
#second_div
{
width: 306px;
height: 371px;
background-image: url(http://www.whitehouse.gov/sites/default/files/hero_feature/title_image/hero_bkgd_education-in-focus.jpg);
border: solid red;
/* position absolute _inside_ a position relative allows for absolute positioning within an element and not the entire page */
position:absolute;
top:0;
right:0;
}
#third_div
{
margin:0 320px 0 0;
/*sholdnt need a height, but for demonstration purposes */
height:600px;
border: solid purple;
}
</style>
</head>
<body>
<div id="first_div">
<div id="second_div"></div>
<div id="third_div">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment