Why does my whole page move when I change margin-top? - css

Alright, I am making this website, from a tutorial, yes I am still a beginner, no the tutorial did not explain why this things happens.
Basically, this is what happens, I have the CSS like this.
#charset "utf-8";
/* CSS Document */
body { font-family: Arial, Helvetica, sans-serif; }
.container
{
width: 800px;
margin: 0 auto;
}
body, div, h1, h2, h3, h4, h5, h6, p, ul, img {margin:0px; padding:0px; }
#main
{
background: url(images/header.jpg) repeat-x;
}
#main .container
{
background: url(images/shine_04.jpg) no-repeat;
}
#logo
{
background: url(images/logo.png) no-repeat;
height:104px;
width:301px;
}
#logo h1
{
text-indent: -9999px;
margin-top: 40px;
}
And my HTML like this, I only post the body.
<div id="main">
<div class="container">
<div id="header">
<div id="logo">
<h1>Logo</h1>
</div>
<div id="tagline">
<h3>I Love Stuff</h3>
</div>
<ul id="menu">
<li>Home</li>
<li>About</li>
<li>Portfolio</li>
<li>Contact</li>
</ul>
</div><!--end header -->
<div id="content">
<h2>Lorem ipsum, Dolor sit</h2>
<h3>Nullam vulputate felis id odio interdum nec malesuada mi pretium. </h3>
<p>Praesent luctus egestas nisl, vitae vehicula eros rhoncus vel.
Phasellus consequat arcu eu neque convallis eu vulputate diam vehicula. In eget venenatis nisl.
Vestibulum id nulla eu sapien pellentesque malesuada pharetra ac lacus.
Curabitur et ultricies quam. Aenean pretium aliquet velit, gravida vulputate urna tempus vel. </p>
<p>Proin tempor erat sit amet nisl porta nec vulputate arcu imperdiet. Praesent luctus egestas nisl, vitae vehicula eros rhoncus vel.
Phasellus consequat arcu eu neque convallis eu vulputate diam vehicula. In eget venenatis nisl.
Vestibulum id nulla eu sapien pellentesque malesuada pharetra ac lacus. Curabitur et ultricies quam. Aenean pretium aliquet velit,
gravida vulputate urna tempus vel. Proin tempor erat sit amet nisl porta nec vulputate arcu imperdiet. </p>
<div id="news">
<h3>Latest Updates</h3>
<h4>Vestibulum id nulla eu sapien pellentesque</h4>
<small>June 1, 2009</small>
<p>Ut vel turpis a orci pulvinar tincidunt. Mauris id purus turpis. Aliquam metus arcu,
facilisis quis pellentesque vitae, dapibus non nulla. Nulla suscipit sagittis sodales.
Etiam laoreet ante in purus laoreet id malesuada dui pretium. Read More</p>
<h4>Vestibulum id nulla eu sapien pellentesque</h4>
<small>June 1, 2009</small>
<p>Ut vel turpis a orci pulvinar tincidunt. Mauris id purus turpis. Aliquam metus arcu,
facilisis quis pellentesque vitae, dapibus non nulla. Nulla suscipit sagittis sodales.
Etiam laoreet ante in purus laoreet id malesuada dui pretium. Read More</p>
</div><!--end news-->
</div><!--end content-->
<div id="sidebar">
<div id="subscribe">
<h3>Subscribe!</h3>
<ul>
<li>Subscribe via RSS</li>
<li>Get Email Updates</li>
<li>Follow us on Twitter</li>
</ul>
</div>
<div id="popular">
<h3>Popular Items</h3>
<ul>
<li>Lorem ipsum dolor site amet</li>
<li>Ulvinar tincidunt, Mauris id</li>
<li>Lorem ipsum dolor site amet</li>
<li>Proin tempor erat sit tene</li>
</ul>
</div>
<div id="contributors">
<h3>Contributors</h3>
<ul>
<li>John Smith, freelance writer</li>
<li>Jack McCoy, designer</li>
<li>Lenny Briscoe, editor</li>
<li>John Smith, martketing</li>
</ul>
Join Our Team
</div>
</div><!--end sidebar-->
</div><!--end main container-->
</div><!--end main-->
<div id="footer">
<div class="container">
<p>Copyright © 2009 MySite <br />
All Rights Reserved</p>
</div><!--end footer container-->
</div><!--end footer-->
In the CSS, I have the #logo h1 selector, as you can see from the parent #logo selector, I have a background, which is exactly the logo, now I want the damn logo to be positioned 40px slightly lower from the top, that's why I put margin-top: 40px; , and I don't understand why, but instead of just the logo moving 40px down, the whole page moves down! T_T, I have already spent almost 1 hour trying to deduce all the logic that my brain can handle behind this, but I just cant!
And my question is just like what I said, why does the whole page move downwards? the logo image is the only element that's supposed to move, but why the whole thing? and what do I do to fix it?

Try substituting margin with padding: padding-top: 40px on the parent container, i.e. #header, since you have specified a background image for #logo and do not have to see it move.
Why paddings over margins? It's simple: margins have the propensity to collapse. W3C has a comprehensive section dedicated to rules that govern margin collapse.
p/s: For the ease of troubleshooting, try posting your issue on JSFiddle. Not only does it help the community to visualize your problem, but it also aids to expedit the process of actually solving your problem.

Try
#logo
{
background: url(images/logo.png) no-repeat;
height:104px;
width:301px;
background-attachment:fixed;
background-position: 0px 40px;
}

try this:
#logo
{
background:url(images/logo.png) no-repeat;
background-position: 0px 40px;
height:144px;
width:301px;
}

Related

Prevent image from expanding beyond other elements of flex row [duplicate]

This question already has answers here:
One flex/grid item sets the size limit for siblings
(6 answers)
Closed 3 years ago.
I am trying to build a card-based layout, with an image taking up the left-hand half of each card. If I use a div with a background-image, the image takes up exactly half the width, and expands to exactly the height of the content on the right-hand side of the card.
However, if I instead use an img element (with object-fit: cover), the image never crops vertically when the card is too short, but instead only horizontally when the card is too tall. How can I tell the image not to cause the card to stretch, reproducing the behaviour of the div's background image?
As an example, the third and fourth cards are what I am trying to achieve, but with an image tag for semantic reasons.
main {
display: flex;
flex-direction: column;
max-width: 700px;
margin: auto;
}
article {
display: flex;
flex-direction: row;
border: 1px solid;
margin: 1em;
}
article > img {
object-fit: cover;
width: 50%;
flex-grow: 0;
flex-shrink: 0;
}
article > div:first-child {
background-position: center;
background-size: cover;
width: 50%;
flex-grow: 0;
flex-shrink: 0;
}
article > aside {
padding: 1em;
}
<main>
<article>
<img src="https://picsum.photos/id/411/1000/900" />
<aside>
<h2>img taller than the text</h2>
<p>
Here the image extends beyond the text, which I do not want.
</p>
</aside>
</article>
<article>
<img src="https://picsum.photos/id/411/1000/900" />
<aside>
<h2>img shorter than the text</h2>
<p>
With enough text, the image is the right height, with both the <kbd>img</kbd> tag and the background image.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ut turpis est. Maecenas vehicula tempor purus, non laoreet turpis aliquet sit amet. Sed pellentesque augue at risus dignissim porttitor. Curabitur aliquam justo ut ante imperdiet lobortis. Aenean sit amet dui eros. Pellentesque dictum imperdiet ex in condimentum. Proin imperdiet eros a sapien egestas, quis auctor arcu laoreet. In interdum at ligula sit amet ornare. Mauris sed feugiat eros. Vestibulum in eros auctor, iaculis neque eu, tincidunt neque. Curabitur eget ligula ac tortor viverra cursus non id nunc. Morbi vestibulum ligula felis, id aliquam metus placerat at. In sed urna bibendum, volutpat ipsum et, placerat dui.
</p>
</aside>
</article>
<article>
<div style="background-image: url(https://picsum.photos/id/411/1000/900)">
</div>
<aside>
<h2>background image</h2>
<p>
With very little text, the background image is cropped to take up little height, which is what I'm trying to achieve with an image tag.
</p>
</aside>
</article>
<article>
<div style="background-image: url(https://picsum.photos/id/411/1000/900)">
</div>
<aside>
<h2>background image</h2>
<p>
With enough text, the image is the right height, with both the <kbd>img</kbd> tag and the background image.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ut turpis est. Maecenas vehicula tempor purus, non laoreet turpis aliquet sit amet. Sed pellentesque augue at risus dignissim porttitor. Curabitur aliquam justo ut ante imperdiet lobortis. Aenean sit amet dui eros. Pellentesque dictum imperdiet ex in condimentum. Proin imperdiet eros a sapien egestas, quis auctor arcu laoreet. In interdum at ligula sit amet ornare. Mauris sed feugiat eros. Vestibulum in eros auctor, iaculis neque eu, tincidunt neque. Curabitur eget ligula ac tortor viverra cursus non id nunc. Morbi vestibulum ligula felis, id aliquam metus placerat at. In sed urna bibendum, volutpat ipsum et, placerat dui.
</p>
</aside>
</article>
</main>
You can simply make the image out of the flow using position:absolute so only the text content will define the height:
main {
display: flex;
flex-direction: column;
max-width: 700px;
margin: auto;
}
article {
/*display: flex;
flex-direction: row; not needed sine one element is in-flow */
border: 1px solid;
margin: 1em;
position:relative;
}
article > img {
position:absolute;
top:0;
left:0;
height:100%;
width:50%;
object-fit: cover;
}
article > aside {
padding: 1em;
width:50%;
margin-left:auto;
box-sizing:border-box;
}
<main>
<article>
<img src="https://picsum.photos/id/411/1000/900" />
<aside>
<h2>img taller than the text</h2>
<p>
Here the image extends beyond the text, which I do not want.
</p>
</aside>
</article>
<article>
<img src="https://picsum.photos/id/411/1000/900" />
<aside>
<h2>img shorter than the text</h2>
<p>
With enough text, the image is the right height, with both the <kbd>img</kbd> tag and the background image.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ut turpis est. Maecenas vehicula tempor purus, non laoreet turpis aliquet sit amet. Sed pellentesque augue at risus dignissim porttitor. Curabitur aliquam justo ut ante imperdiet lobortis. Aenean sit amet dui eros. Pellentesque dictum imperdiet ex in condimentum. Proin imperdiet eros a sapien egestas, quis auctor arcu laoreet. In interdum at ligula sit amet ornare. Mauris sed feugiat eros. Vestibulum in eros auctor, iaculis neque eu, tincidunt neque. Curabitur eget ligula ac tortor viverra cursus non id nunc. Morbi vestibulum ligula felis, id aliquam metus placerat at. In sed urna bibendum, volutpat ipsum et, placerat dui.
</p>
</aside>
</article>
Similar question: How can you set the height of an outer div to always be equal to a particular inner div?
main {
display: flex;
flex-direction: column;
max-width: 700px;
margin: auto;
}
article {
display: flex;
flex-direction: row;
border: 1px solid;
margin: 1em;
}
article > img {
object-fit: cover;
width: 50%;
flex-grow: 0;
flex-shrink: 0;
}
article > div:first-child {
background-position: center;
background-size: cover;
width: 50%;
flex-grow: 0;
flex-shrink: 0;
}
article > aside {
padding: 1em;
}
.img-container{
border:2px solid red;
overflow:hidden;
position:relative;
}
.img-container div{
position:absolute;
left:0;
top:0;
width:100%;
height:100%;
}
.img-container img{
object-fit: cover;
width:100%;
height:100%;
}
<main>
<article>
<div class="img-container">
<div>
<img src="https://picsum.photos/id/411/1000/900" />
</div>
</div>
<aside>
<h2>img taller than the text</h2>
<p>
Here the image extends beyond the text, which I do not want.
</p>
</aside>
</article>
<article>
<div class="img-container">
<img src="https://picsum.photos/id/411/1000/900" />
</div>
<aside>
<h2>img shorter than the text</h2>
<p>
With enough text, the image is the right height, with both the <kbd>img</kbd> tag and the background image.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ut turpis est. Maecenas vehicula tempor purus, non laoreet turpis aliquet sit amet. Sed pellentesque augue at risus dignissim porttitor. Curabitur aliquam justo ut ante imperdiet lobortis. Aenean sit amet dui eros. Pellentesque dictum imperdiet ex in condimentum. Proin imperdiet eros a sapien egestas, quis auctor arcu laoreet. In interdum at ligula sit amet ornare. Mauris sed feugiat eros. Vestibulum in eros auctor, iaculis neque eu, tincidunt neque. Curabitur eget ligula ac tortor viverra cursus non id nunc. Morbi vestibulum ligula felis, id aliquam metus placerat at. In sed urna bibendum, volutpat ipsum et, placerat dui.
</p>
</aside>
</article>
<article>
<div style="background-image: url(https://picsum.photos/id/411/1000/900)">
</div>
<aside>
<h2>background image</h2>
<p>
With very little text, the background image is cropped to take up little height, which is what I'm trying to achieve with an image tag.
</p>
</aside>
</article>
<article>
<div style="background-image: url(https://picsum.photos/id/411/1000/900)">
</div>
<aside>
<h2>background image</h2>
<p>
With enough text, the image is the right height, with both the <kbd>img</kbd> tag and the background image.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ut turpis est. Maecenas vehicula tempor purus, non laoreet turpis aliquet sit amet. Sed pellentesque augue at risus dignissim porttitor. Curabitur aliquam justo ut ante imperdiet lobortis. Aenean sit amet dui eros. Pellentesque dictum imperdiet ex in condimentum. Proin imperdiet eros a sapien egestas, quis auctor arcu laoreet. In interdum at ligula sit amet ornare. Mauris sed feugiat eros. Vestibulum in eros auctor, iaculis neque eu, tincidunt neque. Curabitur eget ligula ac tortor viverra cursus non id nunc. Morbi vestibulum ligula felis, id aliquam metus placerat at. In sed urna bibendum, volutpat ipsum et, placerat dui.
</p>
</aside>
</article>
</main>
Use object-fit: cover; width:100%; height:100%;. You need to specify width and height with "object-fit: cover" to achieve this.

Space inside Bootstrap button on hover

I have this weird case because my bug displays differently at my website and at JSFiddle. That's why I also put a printscreen to show you how it looks on my website.
Here is the JSFiddle: https://jsfiddle.net/Pysilla/cm8s1d7t/
<section id="fashion" class="img-responsive">
<div class="container">
<div class="row">
<div class="item element col-md-5">
<div class="page-header">
<h2>Fashion<span> photos</span></h2>
</div>
<p>Betiam finibus ac tellus sed ullamcorper. Suspendisse vestibulum mollis feugiat. Fusce vel turpis vitae nulla ullamcorper gravida non vel dolor. Ut rhoncus, metus vitae ultrices varius, ex mauris sodales leo, quis imperdiet turpis ipsum et ante. Phasellus hendrerit rutrum tincidunt. Sed sed viverra ligula, non ullamcorper mauris. Quisque dignissim sollicitudin nulla quis tincidunt. Cras at elementum massa. Cras eget mi hendrerit, congue nunc in, tristique massa. Vivamus at vestibulum ex.</p>
<div class="text-center">
<span>See more</span>
</div>
</div>
</div>
</div>
</section>
(When you change size of screen you could see little stripe on the left inside of the button)
I hope you could see the difference.
You just need to account for the 2px border on .btn-primary. You can use translate(calc(-100% - 2px)); on the hidden state of the pseudo element.
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css" rel="stylesheet"/>
<style>
.btn-primary{
margin-top:1em;
background-color:#3CD3DC;
background-image:none;
border:2px solid #3CD3DC;
display:inline-block;
transition:all 0.3s;
overflow:hidden;
box-shadow:none !important;
position:relative;
}
.btn-primary:hover{
background-color:transparent;
border:2px solid #3CD3DC;
}
.btn-primary:before{
content:"";
position:absolute;
background-color:#1fa5ad;
width:100%;
height:100%;
top:0;
left:0;
transform:translateX(calc(-100% - 2px));
transition: 0.8s;
}
.btn-primary:hover:before{
transform:translateX(0%);
left:0;
}
.btn-primary span{
position:relative;
}
</style>
<section id="fashion" class="img-responsive">
<div class="container">
<div class="row">
<div class="item element col-md-5">
<div class="page-header">
<h2>Fashion<span> photos</span></h2>
</div>
<p>Betiam finibus ac tellus sed ullamcorper. Suspendisse vestibulum mollis feugiat. Fusce vel turpis vitae nulla ullamcorper gravida non vel dolor. Ut rhoncus, metus vitae ultrices varius, ex mauris sodales leo, quis imperdiet turpis ipsum et ante. Phasellus hendrerit rutrum tincidunt. Sed sed viverra ligula, non ullamcorper mauris. Quisque dignissim sollicitudin nulla quis tincidunt. Cras at elementum massa. Cras eget mi hendrerit, congue nunc in, tristique massa. Vivamus at vestibulum ex.</p>
<div class="text-center">
<span>See more</span>
</div>
</div>
</div>
</div>
</section>
Another alternative is to set the button's :before element visibility to "hidden" by default and then "visible" on mouse over.
.btn-primary:before{
content:"";
position:absolute;
background-color:#1fa5ad;
width:100%;
height:100%;
top:0;
left:0;
transform:translateX(-100%);
transition: 0.8s;
visibility: hidden;
}
.btn-primary:hover:before{
transform:translateX(0%);
left:0;
visibility: visible;
}
https://jsfiddle.net/cm8s1d7t/1/

CSS Float Issue - Divs displaying in improper location

I have 3 divs. The first div is the rectangular border. I tried different combinations of floating to get the 2 divs to display next to the first div, but have been unsuccessful. Here is the code below and the jsfiddle.
<div class="attempt">
</div>
<div>
<ul id="menu">
<li><a style="background:#3F4E64" href="/html/default.asp">Button1</a></li>
<li><a style="background:#788291">Button2</a></li>
</ul>
</div>
<div>
<H2>TITLE</H2>
<p>
BADKADA
</p>
<p>
Fusce luctus ipsum in dui accumsan, posuere scelerisque lacus ultrices. Quisque quis ultricies nunc. Nam augue magna, eleifend id mi vel, pretium
</p>
<p>
Fusce luctus ipsum in dui accumsan, posuere scelerisque lacus ultrices. Quisque quis ultricies nunc. Nam augue magna, eleifend id mi vel, pretium
</p>
CSS
.attempt {
width:15px;
height:1290px;
background: #3F4E64
}
https://jsfiddle.net/ksaluja/f1s51sj4/
Take out the display property so the first div defaults to block. Then float it to the left and give it a margin-right of 20px or so to give the content some breathing room.
.attempt {
float:left;
width: 15px;
height: 1290px;
background: #3F4E64;
margin-right:20px;
}
<div class="attempt">
</div>
<div>
<ul id="menu">
<li><a style="background:#3F4E64" href="/html/default.asp">Button1</a></li>
<li><a style="background:#788291">Button2</a></li>
</ul>
</div>
<div>
<H2>TITLE</H2>
<p>
BADKADA
</p>
<p>
Fusce luctus ipsum in dui accumsan, posuere scelerisque lacus ultrices. Quisque quis ultricies nunc. Nam augue magna, eleifend id mi vel, pretium
</p>
<p>
Fusce luctus ipsum in dui accumsan, posuere scelerisque lacus ultrices. Quisque quis ultricies nunc. Nam augue magna, eleifend id mi vel, pretium
</p>
<p>
Fusce luctus Fusce luctus ipsum in dui accumsan, posuere scelerisque lacus ultrices. Quisque quis ultricies nunc. Nam augue magna, eleifend id mi vel, pretium fring.
</p>
</div>
Setting the display property for the attempt div to 'inline-block' will display the div as an inline-block container, so any content or div's ahead will be displayed after it and not by side. So, to get the next divisions to the side of the first one, you can do as #symlink explained. 'block' or the default property of display, will set the div as an independent block, and other divisions will align on the side to this block.

Responsive background with its height based on the adjacent column using bootstrap

How can I have a full image background inside a column but without knowing the height of it? Im using bootstrap and I need the image to be responsive.
Please look at the image for a better understanding
<div class=" col-xs-12 col-sm-5 col-md-5 col-lg-4 bgimage">
</div>
<div class=" col-xs-12 col-sm-7 col-md-7 col-lg-8">
</div>
with .bgimage
{
background-image: url(../img/user.jpg);
background-size: cover;
}
here's a bootstrap example of a column that has background-size:cover
http://jsfiddle.net/maio/7rbjj2fn/3/
.bgimage{
background-image: url(http://oi58.tinypic.com/2u9mo0g.jpg);
background-size: cover;
height:200px
}
.right{
background:yellow;
height:100%;
}
.row{
background:tomato
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class='row'>
<div class=" col-sm-5 col-md-5 col-lg-4 bgimage">
</div>
<div class="right col-sm-7 col-md-7 col-lg-8">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper
Using background-size: cover; will cover the box without losing the ratio.
Using background-size: 100%; will fill the box but will losing the ratio.
EDIT
This is sample how the background works.
.table {
display: table;
width: 100%;
}
.cell {
display: table-cell;
}
.cell.left {
background-image: url(http://oi58.tinypic.com/2u9mo0g.jpg);
background-size: cover;
}
.cell.right {
width: 60%;
padding: 80px 30px;
background: #ccc;
}
<div class="table">
<div class="cell left"></div>
<div class="cell right">
Lorem ipsum dolor sit amet
</div>
</div>

html 5 positionning with or without div

I would like to know if for the demo index page of this site url, I can prevent the text from overflowing or let say use optional scrolling bar when the text goes over the bottom of the blue box? I would like the layout to be similar to this 'production' site (with server stats visits).
Can I do this using html 5? Should I include div so to limit text overflow under a certain screen resolution. Please find the html and style sheet code used (thanks for the author of this design and also Aayushi Jain who has help me with a few style sheet adjustments from another question here on this site).
style sheet
html {
overflow-y: scroll; }
div#wrapper {
width:90%;
margin: 10px auto;
position: relative;}
header#site {
height:80px;
padding:10px;
background-color:#0033FF;
margin:10px 0px;
text-align:center; }
footer {
font-size:0.8em;
clear:both;}
footer .col {
width:30%;
margin:1% 1.1%;
padding:2px;
height:100px;
background-color:#F63;
float:left; }
nav {
background-color:#0033FF;
position: absolute;
left: 0;
bottom: 0;
top: 110px;
width: 29%; }
nav ul {
list-style:none;}
nav ul li a {
display: block;
background-color:#CCC;
margin-right: 20px;
width: 110px;
line-height:1.5em;
text-align: center;
text-decoration: none;
color: #000; }
nav ul li a:hover {
color: #fff;
background-color:#39C; }
article {
background-color:#0066FF;
float:right;
width:69%;
margin-right:10px;
height:50%;
overflow-y:scroll;
}
article header {
background-color:#F90;
padding:15px; }
section#abstract {
font-size:1.09em;
font-style:italic;
margin:10px 0px;
text-align:justify;
padding:5px 80px; }
section#main {
font-size:1em;
padding:20px;
text-align:justify;
float: left;
margin: 0;
padding: 0;
display: inline; }
.ads {
height:50%;
width:30%;
background-color:#0033FF;
margin-bottom:1%;
float:left;}
.ads p:first-child {
padding:15px;
font-size:2em;}
.ads p:last-child {
padding-left:15px;
font-size:1em;color:#CCC;}
the html file
<!DOCTYPE html>
<!-- saved from url=(0064)http://toytic.com/class/examples/e808_html5_Header2NavAside.html -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Web site</title>
<link href="style.css" rel="stylesheet" />
<style>
</style>
<!-- Tell IE we are using html5 + CSS -->
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
<body>
<div id="wrapper">
<header id="site">
<h1>WEBSITE</h1>
</header>
<article>
<header>
<h2>This is the article header</h2>
<time datetime="25-11-2010" pubdate="">25th November 2010</time>
</header>
<section id="abstract">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam et orci sed neque tincidunt dictum nec at lacus. Fusce feugiat sagittis ligula ac aliquam. Integer ut sodales justo. Etiam ultrices cursus iaculis. Suspendisse bibendum. </p>
</section>
<section id="main">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac velit mauris. Nulla cursus pretium dapibus. Fusce at faucibus mi. Etiam ac nisi condimentum quam vulputate euismod. Nunc viverra consectetur tempor. Praesent rutrum diam in leo lacinia sit amet volutpat leo tempus. Donec sodales, velit et viverra imperdiet, velit leo placerat libero, fringilla scelerisque justo sapien sit amet sapien. Donec blandit tellus at mi hendrerit hendrerit. Sed suscipit sagittis sodales. Etiam sagittis, tortor quis sagittis laoreet, erat nibh mollis sem, ut tristique felis augue non metus. </p>
<p>Etiam in gravida mi. Maecenas placerat, justo vel gravida egestas, odio sem dictum justo, eget volutpat massa augue in augue. Sed tempus sem a nulla eleifend aliquet aliquet diam pharetra. Proin sit amet imperdiet est. Cras vitae felis in nulla tristique porttitor ut sit amet neque. Quisque sed nisi quam. Aliquam erat volutpat. Nullam dignissim augue odio. Nam sit amet ipsum arcu, id rutrum felis. Phasellus velit mauris, dictum eget tincidunt eget, condimentum eget risus. Proin nibh nulla, sagittis et feugiat in, luctus quis velit. Aenean lobortis mi ut odio accumsan adipiscing. Nulla quis ipsum magna. Suspendisse auctor mauris eu mi cursus ultrices. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas gravida vulputate leo, consectetur porta sem euismod nec. Donec et dolor lectus, vel cursus massa. Morbi eu dictum arcu. Fusce luctus porttitor neque, sed eleifend orci tristique convallis. </p>
</section>
</article>
<nav>
<ul>
<li>About</li>
<li>Service</li>
<li>Contact</li>
</ul>
</nav>
<footer>
<div class="col">
<h4>Contact</h4>
<adress>
<p>Janet Griffith from Public Relations</p>
<p>Jil Sanders, webmaster</p>
</adress></div>
<div class="col">
<h4>Sites of interest</h4>
<aside>
<p>Site A</p>
<p>Another one</p>
</aside>
</div>
<div class="col">
<h4>Legal stuff</h4>
<p>Copyright</p>
<p>Terms of Service</p>
</div>
</footer>
</div>
</body></html>
thanks
Pascal
If you don't want to see the scroll bar then use overflow: hidden or overflow: auto.
Now if you want the header part to be static then put your section main and abstract in a div and make its height: 500px (or something you want) but make it fix and then use overflow: hidden in the newly mad div if you don't want to show the overflow part or use overflow: auto if you want to show the overflow part but not the scroll bar.

Resources