Forum Moderators: not2easy

Message Too Old, No Replies

Applying Border

         

0x0123

4:55 pm on Feb 13, 2011 (gmt 0)

10+ Year Member



I'm playing around with a little test website here:

As you can see on that page all the content is green and surrounded by a dotty line. This should not be so.

In my css I have:

#bordas{
border-color: grey; border-style:dashed; background-color: green;
}

and then in my html (well...its php, no php yet though, just html):


<body id="one">
<div id="bordas">
<div id="banner">
<img alt="logo" src="logo.jpg">
</div>

<div id="navvy">
<div align="center">
<li id="one"><a href="testside2.php">PAGE 1</a></li>
<li id="two"><a href="tester2.php">PAGE 2</a></li>
<li id="three"><a href="http://www.wikipedia.org">WIKI</a></li>
<li id="four"><a href="http://www.wikipedia.org">WIKI2</a></li>
<li id="five"><a href="http://www.wikipedia.org">WIKI3</a></li>
<li id="six"><a href="http://www.wikipedia.org">WIKI4</a></li>
<li id="contact"><a href="mailto:meeeee@thingy.com">CONTACT</a></li>
<li id="nine"><a href="http://cannygood.vacau.com">BACK TO HOME</a></li>
</div>
</div>

<div id="content">
<p>What follows is gibberish so as to bulk up the page, fetched via wikipedia's random page button.Following the widespread commercial success of the band's third studio album, Enema of the State, and the subsequent touring to support the album, the band spent three weeks writing new songs at their practice space in San Diego and recorded them over a period of three months at Signature Sounds Recordings studios with producer Jerry Finn.The album was written and recorded in the same manner as Enema, albeit less "polished" (according to bassist Mark Hoppus). Influenced by bands such as Fugazi and Refused during the recording sessions, the band had a desire to make the album much heavier.[2]
</div>



As you can see what I'm trying to get is just a tight green block around the logo and the menu (yes, it would be ugly, just testing for now). Why has it spilled out to all of my content? How can i fix it and get the tight central green block I want?

[1][edited by: alt131 at 6:59 am (utc) on May 19, 2011]
[edit reason] Thread Tidy [/edit]

rainborick

6:23 pm on Feb 13, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You haven't added a </div> for the <div id="bordas"> tag. An easy way to spot such problems is to run your page through a validator like validator.w3.org.

0x0123

6:42 pm on Feb 13, 2011 (gmt 0)

10+ Year Member



Damn.....didn't notice I'd used two divs for the links, it all seemed to check out when I was checking for that problem. Woops...that was a waste of a post.

Thanks for the validator link. Was looking for that.

0x0123

6:44 pm on Feb 13, 2011 (gmt 0)

10+ Year Member



Doing that though...the border stays around the logo but not the navigation menu.
Also, it fill the entire screen rather than just the centre. How is that fixed?

rainborick

7:44 pm on Feb 13, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The </div> has to come between the </div> for "navvy" and the <div id="content"> tag. You'll also probably need to add width: and padding: to the CSS settings for "bordas", "logo" and "navvy" to allow the green background to be visible.

0x0123

8:41 pm on Feb 13, 2011 (gmt 0)

10+ Year Member



It already does cxome before navvy's div, now I have:


<body id="one">
<div id="bordas">
<div id="banner">
<img alt="logo" src="logo.jpg">
</div>

<div id="navvy" align="center">
<li id="one1"> <a href="testside2.php">PAGE 1</a></li>
<li id="two1"> <a href="tester2.php">PAGE 2</a></li>
<li id="three1"> <a href="http://www.wikipedia.org">WIKI</a></li>
<li id="four1"> <a href="http://www.wikipedia.org">WIKI2</a></li>
<li id="five1"> <a href="http://www.wikipedia.org">WIKI3</a></li>
<li id="six1"> <a href="http://www.wikipedia.org">WIKI4</a></li>
<li id="contact1"> <a href="mailto:meeeee@email.com">CONTACT</a></li>
<li id="nine1"> <a href="http://cannygood.vacau.com">BACK TO HOME</a></li>
</div>
</div>

<div id="content">
<p>What follows is gibberish so as to bulk up the page, fetched via wikipedia's random page button.Following the widespread commercial success of the band's third studio album, Enema of the State, and the subsequent touring to support the album, the band spent three weeks writing new songs at their practice space in San Diego and recorded them over a period of three months at Signature Sounds Recordings studios with producer Jerry Finn.[1] The album was written and recorded in the same manner as Enema, albeit less "polished" (according to bassist Mark Hoppus). Influenced by bands such as Fugazi and Refused during the recording sessions, the band had a desire to make the album much heavier.[2]
</div>

alt131

4:17 am on Feb 14, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



HI 0x0123, and welcome to WebmasterWorld [webmasterworld.com]

I think what you are looking at is the closing for div#center.
I've reduced your code so you can see what rainborick meant, and noted where there are missing elements or closings - as rainborick says run your code through the validator when code isn't working as desired :)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test Site</title>
<style type="text/css">

#banner{
margin: auto;
text-align: center;
}

#bordas {
border: 5px dotted silver;
background-color: green;
}

#navvy {
clear:both;
width:100%;
margin:22px 0;
}

#navvy ul {
list-style-type:none;
padding:0;
margin: 0 auto;
}

#navvy li {
line-height: 200%; /* missing semi colon*/
display:inline;
}

#navvy li a {
padding:12px;
line-height: 50px;
/*background:#3062ff; should be background-color */
background-color: #3062ff;
color:white;
text-decoration:none
}

#content {
margin:auto;
width:70%;
background-color:#b0e0e6;
clear:both;
}
</style>
</head>

<body id="one">
<div id="bordas">

<div id="banner">
<img alt="logo" src="red.jpg" height="198" width="940"><!-- insert dimensions -->
</div><!-- end banner -->

<div id="navvy">
<div align="center">
<ul><!-- insert list -->
<li id="one"><a href="testside2.php">PAGE 1</a></li>
<li id="two"><a href="tester2.php">PAGE 2</a></li>
</ul><!-- insert close list -->
</div><!-- end navvy -->

</div><!-- end center -->
</div> <!-- insert end bordas -->

<div id="content">
<p>Lorem ipsitor </p><!-- close the p -->
</div>
<!-- move the script inside the body -->
</body>
</html>

0x0123

6:50 pm on Feb 15, 2011 (gmt 0)

10+ Year Member



hmm, so it was the float centre in navvy that was somehow messing it up :s
Strange.

It covers the whole lot now, it covers the entire screen at the top however- what I'm after is a 'tight' border, the green just surrounding the logo and menu with the normal background visible to the sides. How do I do this?

alt131

5:10 pm on Feb 16, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hmm, so it was the float centre in navvy that was somehow messing it up

Only partially. The issue you posted about was caused by the missing close for bordas. The primary irritation with the float was the horizontal scrolling. That wasn't identified, but I figured it wasn't desired, so fixed it along the way.

I think where you are headed requires widths. The only one currently present in the html is the 940px image, so all the other elements expand to the full width of the viewport. Try setting widths slightly greater than 940px on bordas until you get the effect you want.

0x0123

5:28 pm on Feb 17, 2011 (gmt 0)

10+ Year Member



Ah, simpler than I thought, works great, thanks.