Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
CSS trouble with ... layers?
Old 11-07-2004, 07:13 PM CSS trouble with ... layers?
Archie's Avatar
Skilled Talker

Posts: 64
Trades: 0
I'm new to CSS but I've got a simple grasp of how to design with it. I really love it but I ran into trouble on my design (you may have seen it before on a tutorial), I just finished the tutorial and decided to run with what I had learned, but I ran into a stopsign

http://www.arnoldesign.com/surrealvision/index.html

As you can see, everything seems fine except for one big problem. Those points that show up behind the center panel (#main-content) are an image, and I want them to show up in FRONT of the #main-content. The only way I could achieve it was to put the <div id="banner"> AFTER the <div id="main-content"> and give the #banner a huge negative margin-top. This won't work however, because the <div id="main-content"> won't always be the same height, and so that negative margin I gave the banner will only work for this precise page.

If I move the <div id="banner"> back above the <div id="main-content"> and give the #main-content a negative margin it puts the banner and the content in the right place, but the banner is still behind the content section. I'm sure there's a simple tag for the CSS to fix this but I don't know it.

Heres the CSS file...

Code:
/*this is the core design*/
 body {
 margin:0px;
 background-color:#000000;
 color:#ffffff;
 font-family:Verdana, Arial, Helvetica, sans-serif;
 font-size:1em;
 margin:0;
 }
 
 p {
 font-size:0.8em;
 text-align:justify;
 line-height:1.7em;
 }
 
 h1 {
 font-size:1.2em;
 text-align:right;
 font-style:italic;
 letter-spacing:5px;
 }
 
 h2 {
 font-size:1.1em;
 text-decoration:underline;
 }
 
  #banner {
 height:100px;
 margin-top:0px;
 background-image:url(images/banner.gif);
 background-repeat:no-repeat;
 background-position:center top;
 }
 
 #main-content {
 background-color:#101920;
 margin-top:-100px;
 margin-left:200px;
 margin-right:200px;
 margin-bottom:0px;
 border-left:1px;
 border-right:1px;
 border:#000000 1px solid;
 padding-top:100px;
 padding-left:10px;
 padding-right:10px;
 padding-bottom:0px;
  }
 
 #navbar {
 border-top: 1px solid #000000;
 position:absolute;
 top:200px;
 left:0px;
 width:200px;
 font-weight:bold;
  }
  
  #navbar a:link, #navbar a:visited {
 display:block;
 color:#ffffff;
 background-color:#1C262F;
 border-left:1px solid #000000;
 border-bottom:1px solid #000000;
 padding-bottom:3px;
 padding-top:3px;
 }
 
  #navbar a:hover {
 background-color:#101920;
 color:#ffffff;
 text-decoration:none;
 }


and here's my HTML file.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


<html>

<head>
<title>index.html</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">

<link rel="stylesheet" type="text/css" href="core.css">

</head>
<body>

<div id="banner"></div>
<div id="main-content">

<h1>lorem ipsum dolor</h1>

<p>Lorem ipsum dolor <a href="http://www.westciv.com/style_master/index.html">sit amet</a>, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, <a href="http://www.westciv.com/style_master/index.html">sed diam nonumy</a> eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>

<h2>ut wisi enim</h2>

<p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>

<p>Nam liber tempor *** soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>

<h2>duis autem</h2>

<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.</p>

<p>At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.</p>

<p>Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>

</div>


<div id="navbar">

<a href="http://www.westciv.com/style_master/index.html" >Lorem ipsum</a> <a href="http://www.westciv.com/style_master/index.html">dolor</a> <a href="http://www.westciv.com/style_master/index.html">consetetur sadipscing</a> <a href="http://www.westciv.com/style_master/index.html">sed diam</a> <a href="http://www.westciv.com/style_master/index.html">consetetur sadipscing</a> <a href="http://www.westciv.com/style_master/index.html">nonumy eirmod</a> <a href="http://www.westciv.com/style_master/index.html">tempor invidunt</a> <a href="http://www.westciv.com/style_master/index.html">ut labore</a> <a href="http://www.westciv.com/style_master/index.html">justo duo</a>

</div>


</body>

</html>
Archie is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-07-2004, 09:18 PM
foobar's Avatar
Extreme Talker

Posts: 225
Trades: 0
Use z-index

Set the z-index of #banner to 1.

Basically, this is what you'll get:

HTML Code:
#banner {
 height:100px;
 margin-top:0px;
 background-image:url(images/banner.gif);
 background-repeat:no-repeat;
 background-position:center top;

<!-- Set the z-index so element has higher priority -->
z-index: 1;
However, I think the element has to have been placed using position: absolute for that to work ...

If that doesn't work, just position using abo****e:

HTML Code:
#banner {
 height:100px;
 margin-top:0px;
 background-image:url(images/banner.gif);
 background-repeat:no-repeat;
 background-position:center top;

<!-- Position using absolute -->
position: absolute;
top: 0;
And just have the content <div> appear before the banner <div> .

Hope that helps/works!
foobar is offline
Reply With Quote
View Public Profile Visit foobar's homepage!
 
Old 11-07-2004, 10:34 PM
Archie's Avatar
Skilled Talker

Posts: 64
Trades: 0
thanks, it worked, but only with position:absolute. I got it Thanks for helping, I can continue to tinker unhindered now
Archie is offline
Reply With Quote
View Public Profile
 
Old 11-07-2004, 11:02 PM
foobar's Avatar
Extreme Talker

Posts: 225
Trades: 0
Glad it helped.

However, you havn't updated the site online, so I can't see what the banner looks like .
foobar is offline
Reply With Quote
View Public Profile Visit foobar's homepage!
 
Old 11-08-2004, 12:19 AM
Archie's Avatar
Skilled Talker

Posts: 64
Trades: 0
hah, you don't want to see it, trust me. its a pile, I just wanted to learn how to do this!
Archie is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to CSS trouble with ... layers?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24849 seconds with 12 queries