View Full Version : Making a DIV a fixed width

04-03-2011, 11:03 PM
Hey, I have a div that I am using as a header bar for my content
I have 2 columns, (main content & side bar) the main content div stays the correct size I specified but the side bar next to it does not stay the width I want it to be, but instead just wraps itself round the text I've entered. I am relatively new to CSS & divs so if somebody could tell me the answer and explain why that'd be very helpful thanks.

Here is the css code for my side bar

width:278 px;
height:30 px;
padding-top: 10px;
padding-right: 10px;
background-image: url(images/contentheaderbg_15.gif);
background-color: rgb(210,209,202);
background-repeat: repeat-x;
color: #333;
text-align: right;

and here is the html

<div class="content">
<div class="leftcolumn">
<div class="contentheader1"> Home &raquo; </div></div>
<div class="rightcolumn">
<div class="contentheader2">Recent Press Coverage</div></div>
<div class="clear"></div>

Content is my holder div, left column is my main content & right column is the side bar. the content header is the one I am having the problem with.

this is the css for the left & right columns & content holder

width:278 px;

Sorry if I haven't explained my problem very well

here is also a screen shot of my site

04-03-2011, 11:29 PM
Hello DaleCee,
It looks like a space is causing your problem - width:278 px; is not really a width. width:278px; is.

The validator finds that and other errors in your CSS. See the links in my signature line about validation.

You might also like to have a look at a very simple 2 column layout here (http://nopeople.com/CSS%20tips/simple_2-column/index.html).

04-03-2011, 11:31 PM
Thanks a lot! I feel silly now =}

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum