Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 29th, 2006, 4:42 PM   #1
SlickTheNick
Newbie
 
Join Date: Oct 2006
Posts: 4
Rep Power: 0 SlickTheNick is on a distinguished road
CSS help

Im pretty inexperienced at CSS, and right now I am trying to get a sidebar up beside a set of divs...anyways some wierd stuff is happening: (screenshot) http://www.ncrusaders.com/random/error.jpg

here is the css that defines it:
#sidebarbg{
    width: 131px;
    float: right;
    clear: left;
    background: url(images/sidebarbg.jpg);

}
#sidebartop{
    width: 131px;
    float: right;
    clear: left;
    height: 20px;
    background: url(images/sidebartop.jpg);

}
#sidebarbottom{
    width: 131px;
    float: right;
    clear: left;
    height: 20px;
    background: url(images/sidebarbottom.jpg);

}
and the html...

<div id="sidebartop">
</div>
<div id="sidebarbg">
test
</div>
<div id="sidebarbottom">
</div>

Help would be greatly apreciated. I posted this on another forum like 5 hours ago and still havnt gotten a response
SlickTheNick is offline   Reply With Quote
Old Oct 29th, 2006, 5:10 PM   #2
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
A whole 5 hours, eh? :p

Anyway, just wrap all your divs up inside another div, like so:
<div id="sidebar">
  <div class="top"></div>
  <div class="body">
    test
  </div>
  <div class="bottom"></div>
</div>
With the corresponding CSS:
#sidebar {
    width: 131px;
    float: right;
}

#sidebar .top {
    height: 20px;
    background: url(images/sidebartop.jpg);
}

#sidebar .body {
    background: url(images/sidebarbg.jpg);
}

#sidebar .bottom {
    height: 20px;
    background: url(images/sidebarbottom.jpg);
}
Arevos is offline   Reply With Quote
Old Oct 29th, 2006, 5:23 PM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
I'd put them in an enclosing div, like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style>
#enclose{
    width: 132px;
    float: right;
    clear: left;
    height: 100%;
}
#sidebarbg{
    width: 130px;
    clear: left;
    background: url(images/sidebarbg.jpg);
}
#sidebartop{
    width: 130px;
    clear: left;
    height: 20px;
    background: url(images/sidebartop.jpg);
}
#sidebarbottom{
    width: 130px;
    clear: left;
    height: 20px;
    background: url(images/sidebarbottom.jpg);
}
</style>
<title>Untitled Document</title>
</head>
<body>
<div id="enclose" style="border: 2px solid #00ff00;">
<div id="sidebartop" style="border: 2px solid #ff0000;">Top
</div>
<div id="sidebarbg" style="border: 2px solid #ffff00;">
Center
</div>
<div id="sidebarbottom" style="border: 2px solid #0000ff;">Bottom
</div>
</div>
</body>
</html>

And if those sorry volunteer suckers didn't respond within 5 hours on a Sunday, I'd demand my money back!!!
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Oct 29th, 2006, 5:33 PM   #4
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Snap
Arevos is offline   Reply With Quote
Old Oct 29th, 2006, 5:49 PM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
LOL! Your post wasn't there when I went off to test it, and I didn't refresh the page!
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:37 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC