...

View Full Version : Colour Block?



spadez
08-08-2007, 06:48 PM
Im trying to make a bar which extends across the page, since it is just a single bar i dont want to tile an image, i just want to specify the colour, height and % width and stick that code in.

Would any one be kind enough to tell me what i should be doing, im a little confused, i tried making a div with those specs but i didnt get anywhere.

Regards,

James

harbingerOTV
08-08-2007, 07:07 PM
if you use a div (by default it is a block-level element) it will be 100% wide and as wide as it's containing element.

something like:



#bar {
background: #000;
height: 10px;
}




<div id="bar"></div>


should accomplish what you need.

spadez
08-08-2007, 07:20 PM
Great that worked! I have another question though if someone could also help me with that. How can i define the left and right margines for the bar, so there is a gap between the bar and the wall of the website?

harbingerOTV
08-09-2007, 12:09 AM
#bar {
background: #000;
height: 10px;
margin: 0 10px;
}


margin goes like most other properties: top, right, bottom and left. since I'm giving the top and bottom both margin of 0 an dleft and right margin of 10px then I can use more shorthand:



margin: 0 10px 0 10px;

/* is shortend to */

margin: 0 10px;


see if that works for you.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum