css help please

  FOEYDO 11:31 22 Feb 2007
Locked

Hi, I am new to css and am building a site, however each page is different and the margin on some pages overlaps the nav bar down the side, how do I set the margin to be in a fixed place?

  Eric10 17:52 22 Feb 2007

You can float your navbar to the left and set your page content in a div with a fixed left margin.

Add 'float: left' to your navbar css if it's not already there and 'margin-left: 180px' to the css for the content but adjust the margin width to suit your requirements.

Example css:
#navbar {
width: 170px;
float: left;
padding: 10px;
}

#content {
margin-left: 180px;
}

call it like this:
<div id="navbar">Navigation Bar code here</div>

<div id="content">Your page content here</div>

  FOEYDO 18:13 22 Feb 2007

hi, thanks for your help it is now the footer that is overlapping the nav bar, how can I remedy this?

  Eric10 20:13 22 Feb 2007

Can't you just apply the same left margin to the style for the footer?

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

What is ransomware and how do I protect my PC from Petya?

Microsoft Surface Studio – the artist's hands-on review

Original iPhone review

Comment mettre à jour Kodi ?