...

View Full Version : My <div> tags aren’t working?



kikaz
11-11-2012, 06:16 PM
Hello there,I'm very new to this but i'm trying my best to learn.
Can SOMEONE EXPLAIN ME DIVS,POSITIONING stuff like that? WHEN I SEE PEOPLE TRANSFORM PSD > HTML looks so easy for them but for me its heck of a job!

This is my code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">



<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Creatif</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div id="banner"> <!-- the logo goes here-->
</div> <!-- end of the banner-->

<div id="navigation"> <!-- the navigation -->
<ul id=navigation">
<li><a href=#>About Us</a></li>
<li><a href=#>Gallery</a></li>
<li><a href=#>Contact Us</a></li>
<li><a href=#>Events</a></li>
<li><a href=#>News</a></li>
</ul>
</div>


<div id="News1"> <!-- the latest news content goes here-->
</div>


<div id="News2"> <!-- the not so latest news content goes here-->
</div>


<div id="Footer"> <!-- the bottom -->
</div>

<div id="Background"> <!--the background -->
</div>
</body>
</html>




but when i open my style.css and for example I write

#News2 {
background-image:url(images/news2.png);
}

nothing happens, i do have a folder named images and i do have that image.
I don't know what is my css supposted to consist for my div tags to work?

I tried Body
{
float:center;
background-image:url('images/background.jpg');
background-size:1380px 1024px;
background-repeat:no-repeat;
background-attachment:fixed;
}

and the background did changed

kikaz
11-11-2012, 08:58 PM
actually,
when for this in html


<div id="navigation"> <!-- the navigation -->
<ul id=navigation">
<li><a href=ԣԾAbout Us</a></li>
<li><a href=ԣԾGallery</a></li>
<li><a href=ԣԾContact Us</a></li>
<li><a href=ԣԾEvents</a></li>
<li><a href=ԣԾNews</a></li>
</ul>
</div>

i write in css this

#navigation
{

width:730px; margin-left: auto; margin-right: auto;
background-image:url(images/navigation.png);
background-repeat:no-repeat;

}

my navigation shows,can someone explain me more about div's and how to properly use them,I'm a newbie trying to learn something.
also can someone tell me how you guys can be so precise into positioning things?

Excavator
11-11-2012, 09:11 PM
Hello kikaz,
The example you've quoted here is invalid. You can only use the id navigation once, see an explanation here (http://www.tizag.com/cssT/cssid.php).

Divs are just boxes of content. It's a very common mistake for new coders to use too many of them, see divitis here (http://www.apaddedcell.com/div-itis).

In the case of the example you've posted, does your ul really need wrapped in another box? That ul can stand on it's own just fine, or it may be that another div is needed to hold a background image that your ul menu sits in.

LearningCoder
11-11-2012, 09:39 PM
It may be quite insignificant but you also left off one set of double quotations after the id= in your <ul> element.

Kind regards,

LC.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum