Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Unhappy My <div> tags aren’t working?

    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
    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
    Code:
    #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
    Code:
    {
    float:center;
    background-image:url('images/background.jpg');
    background-size:1380px 1024px;
    background-repeat:no-repeat;
    background-attachment:fixed;
    }
    and the background did changed
    Last edited by kikaz; 11-11-2012 at 10:00 PM.

  • #2
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts
    actually,
    when for this in html

    Code:
    <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?

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,744
    Thanks
    22
    Thanked 1,838 Times in 1,822 Posts
    Hello kikaz,
    The example you've quoted here is invalid. You can only use the id navigation once, see an explanation here.

    Divs are just boxes of content. It's a very common mistake for new coders to use too many of them, see divitis here.

    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.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #4
    Regular Coder LearningCoder's Avatar
    Join Date
    Jan 2011
    Location
    The Pleiades
    Posts
    925
    Thanks
    76
    Thanked 29 Times in 29 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •