User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 428,563 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,624 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 1558 | Replies: 5 | Solved
Reply
Join Date: Apr 2007
Location: Nottingham
Posts: 91
Reputation: alienlinux is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
alienlinux's Avatar
alienlinux alienlinux is offline Offline
Junior Poster in Training

Help CSS stylesheet layout

  #1  
May 20th, 2007
Hi all, I'm new to css and html too for that matter.

this is my html so far:-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>AlienNet Public Access Gateway</title>
  <embed src="audio/thunder3.wav" autostart="true" loop="false" width="0" height="0"></embed>
  <link rel="icon" type="image/png" href="http://alienlinux.homelinux.net/images/alien.png">
  <link rel="stylesheet" href="mystyle.css">
</head>

<ul class="banner">
test
</ul>

<ul class="navbar">
test
</ul>

<ul class="main">
test
</ul>

and this is my stylesheet:-

  ul.banner {
  position: fixed;
  top: 0px;
  left: 0px;
  right: 0px;
  height: 78px;
  background-color: green;
  padding: 0px;
}

ul.navbar {
  position: fixed;
  top: 78px;
  left: 0px;
  width: 180px;
  height: 100%;
  bottom: 0px;
  background-color: red;
  padding: 0px;
}

ul.main {
  position: fixed;
  top: 78px;
  left: 180px;
  right: 0px;
  width:100%;
  height: 100%;
  bottom: 0px;
  background-color: yellow;
  padding: 0px;
}

my problem is that there is a gap at the top of the page, how do i stop this happening?
thanks
Mark
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2006
Location: Deptford, London
Posts: 964
Reputation: MattEvans has a spectacular aura about MattEvans has a spectacular aura about 
Rep Power: 5
Solved Threads: 48
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Posting Shark

Re: CSS stylesheet layout

  #2  
May 20th, 2007
First up, add a body tag around the body, and a html close tag after everything:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>AlienNet Public Access Gateway</title>
  <embed src="audio/thunder3.wav" autostart="true" loop="false" width="0" height="0"></embed>
  <link rel="icon" type="image/png" href="http://alienlinux.homelinux.net/images/alien.png">
  <link rel="stylesheet" href="mystyle.css">
</head>
<body>
<ul class="banner">
test
</ul>

<ul class="navbar">
test
</ul>

<ul class="main">
test
</ul>
</body>
</html>

Then change your CSS like this:

  ul.banner {
  position: fixed;
  top: 0px;
  left: 0px;
  right: 0px;
  height: 78px;
  background-color: green;
  padding: 0px;
  margin-top:0;
}

ul.navbar {
  position: fixed;
  top: 78px;
  left: 0px;
  width: 180px;
  height: 100%;
  bottom: 0px;
  background-color: red;
  padding: 0px;
  margin-top:0;
}

ul.main {
  position: fixed;
  top: 78px;
  left: 180px;
  right: 0px;
  width:100%;
  height: 100%;
  bottom: 0px;
  background-color: yellow;
  padding: 0px;
  margin-top:0;
}
body
{
  margin-top:0;
  padding-top:0;
}

It gets rid of the white top border for me on Opera9 and Firefox2. The whole layout doesn't work on Internet Explorer 6; you might want to check that out.
If it only works in Internet Explorer; it doesn't work.
Reply With Quote  
Join Date: Oct 2005
Location: Manchester, UK
Posts: 482
Reputation: pty is on a distinguished road 
Rep Power: 3
Solved Threads: 33
pty's Avatar
pty pty is offline Offline
Posting Pro in Training

Re: CSS stylesheet layout

  #3  
May 20th, 2007
Matt is right; try to get used to closing a tag right after you open it then typing between them (this way you won't leave any tags unclosed). Some html editors do this for you (bluefish, quanta, notepad++).
Note to self... pocket cup
Reply With Quote  
Join Date: Apr 2007
Location: Nottingham
Posts: 91
Reputation: alienlinux is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
alienlinux's Avatar
alienlinux alienlinux is offline Offline
Junior Poster in Training

Re: CSS stylesheet layout

  #4  
May 20th, 2007
yeah, thats sorted it ty
Reply With Quote  
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation: jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough 
Rep Power: 30
Solved Threads: 268
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Microsoft Fanboy

Re: CSS stylesheet layout

  #5  
May 20th, 2007
If you want a good editor that closes your tags and higlights your syntax take a look at Aptana (windows)
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
Reply With Quote  
Join Date: Apr 2007
Location: Nottingham
Posts: 91
Reputation: alienlinux is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
alienlinux's Avatar
alienlinux alienlinux is offline Offline
Junior Poster in Training

Re: CSS stylesheet layout

  #6  
May 20th, 2007
i don't use windows, but i have an awesome editor called quanta+ it does do the automatic tagging, i'm thinking of turning it off, it's annoying lol
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb HTML and CSS Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 11:11 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC