Charlie
Charlie

Reputation: 1348

Really simple CSS Site

I am trying to teach myself web design, and I find it amusing that I can code in C and C++ but can't make a website. I'm trying to do something really simple. I have made my header image 234 pixels high and 1 pixel wide. I can make it repeat, but how do I get it to repeat the whole way across the screen and not go past that point and have a sideway scroll bar? I have tried giving it a width in the CSS style sheet however that is the reason behind the need to scroll. I have seen it is possible with Javascript, but am trying to avoid that at the minute.

Thanks

Upvotes: 0

Views: 139

Answers (2)

Hubro
Hubro

Reputation: 59388

If you remove margin/padding from body

body {
    padding: 0px;
    margin: 0px;
}

Then add your header div inside the body element with this css

#header {
    height: 234px;
    background-image: url('images/header.png');
    background-repeat: repeat-x;
}

Then the header should span all across the site without making scrollbars anywhere. Divs have width: 100% by default.

Upvotes: 4

OnResolve
OnResolve

Reputation: 4032

Not sure what you've tried but what you're describing sounds like the repeat-x CSS property. Try that after looking it up--I use it quite a bit in a similiar manner to what you're describing.

Upvotes: 0

Related Questions