Solved

How do I make my DIV position nicely?

Posted on 2009-04-14
9
113 Views
Last Modified: 2013-09-01
Please see the  attached file and code snippet below, one is a CSS file the other is a HTML file.

Please can you tell me how I can edit the CSS file so that the div 'Navigation' sits 1em below the header and 1 em above the Column1 and Column2 divs.

I also need to know how to edit the CSS file so that when the navigation list items (which are links) are clicked upon and the user is taken to the new page the navigation list item they just clicked on now displays as a different color to the other navigation list item links and different to the hover state.

Many thanks.

css.doc
0
Comment
Question by:leonjohnsononline
9 Comments
 
LVL 13

Expert Comment

by:myderrick
ID: 24145841
Use margin-top: 1em and margin-bottom: 1em for the navigation div

MD
0
 
LVL 13

Expert Comment

by:qwerty021600
ID: 24145897
Also the HTML is not shared.
0
 
LVL 13

Expert Comment

by:qwerty021600
ID: 24145920
#body-container #navigation {
      width: 100%;       height: 3em;       background-color: #F00;       display: block;
margin: 1em 0 1em 0;
}  

For the second query
#navigation-items a.visited {
      color: #ff0000;
}
0
 
LVL 13

Expert Comment

by:qwerty021600
ID: 24145924
Oops.. this is the right one.
For the second query
#navigation-items a:visited {
      color: #ff0000;
}
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 13

Expert Comment

by:myderrick
ID: 24145962
Smart qwerty. But I hope there is nothing else affecting the html. ems can be tricky sometimes.

MD
0
 

Author Comment

by:leonjohnsononline
ID: 24146488
Hi,

With regad to the first query nne of the above has helped position my div in between the dheader andand the two columns? Any further suggestion?

The HTML is pasted in the code snippet below.
Leon.
<!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=UTF-8" />

<title>Untitled Document</title>

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

</head>
 

<body>
 

<!--THE MAIN BODY CONTAINER GOES HERE-->

<div id="body-container">

	

    <div id="Header">header goes here</div>

    
 
 
 

<div id="columns">

<!--COLUMN ONE CONTENT GOES HERE-->    

    

    <div id="Column1">

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;</div>
 
 

<!--COLUMN TWO CONTENT GOES HERE-->    

  <div id="Column2">column2 content column2 content  column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content</div>

  

</div>
 
 

<!--THE FOOTER GOES HERE-->    

  <div id="Footer">

  <ul>

  		<li>Terms and Conditions</li>

        <li>Copyright and Creative Commons</li>

        <li>Help</li>

  </ul>

  </div>

    

<!--THE NAVIGATION BAR GOES HERE-->

	<div id="navigation">

    	<ul id="navigation-items">

    		<li><a href="#">Home</a></li>

            <li><a href="http://www.facebook.com">Blog</a></li>

            <li><a href="http://www.bebo.com">Clients and Case Studies</a></li>

            <li><a href="#">About Me</a></li>

        </ul>

    </div>
 

</div>
 
 
 

</body>

</html>

Open in new window

0
 
LVL 13

Accepted Solution

by:
myderrick earned 500 total points
ID: 24146927
Try this code. I changed the position of the navigation.

MD
<!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=UTF-8" />

<title>Untitled Document</title>

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

</head>

 

<body>

 

<!--THE MAIN BODY CONTAINER GOES HERE-->

<div id="body-container">

        

    <div id="Header">header goes here</div>

    

 

 <!--THE NAVIGATION BAR GOES HERE-->

        <div id="navigation">

        <ul id="navigation-items">

                <li><a href="#">Home</a></li>

            <li><a href="http://www.facebook.com">Blog</a></li>

            <li><a href="http://www.bebo.com">Clients and Case Studies</a></li>

            <li><a href="#">About Me</a></li>

        </ul>

    </div>

 
 

 

<div id="columns">

<!--COLUMN ONE CONTENT GOES HERE-->    

    

    <div id="Column1">

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    The main body

    clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;clear: left;</div>

 

 

<!--COLUMN TWO CONTENT GOES HERE-->    

  <div id="Column2">column2 content column2 content  column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content column2 content</div>

  

</div>

 

 

<!--THE FOOTER GOES HERE-->    

  <div id="Footer">

  <ul>

                <li>Terms and Conditions</li>

        <li>Copyright and Creative Commons</li>

        <li>Help</li>

  </ul>

  </div>

    

</div>

 

 

 

</body>

</html>

Open in new window

0
 
LVL 58

Expert Comment

by:Gary
ID: 39456129
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Box Model and Styling 12 34
jQuery Animation faster 5 42
How do i set padding within the sidebar? 2 27
Problem to page 4 72
Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now