Welcome to Dream.In.Code
Become an Expert!

Join 149,519 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,371 people online right now. Registration is fast and FREE... Join Now!




CSS doesn't seem to be affecting divs

 
Reply to this topicStart new topic

CSS doesn't seem to be affecting divs

dean.h
4 Jun, 2007 - 08:20 AM
Post #1

New D.I.C Head
*

Joined: 4 Mar, 2007
Posts: 12


My Contributions
Hi, I'm currently working on a new site for myself, I have done CSS in the past, but have been away from it for a while, so I thought I would try something new and work with the container div class.

I set up my container and basic page formatting, which was fine, and then added some inline navigation to the top of the container, which seemed to work fine, but some of the tags don't seem to be working at all, for example, adding padding to the navigation has no effect.

Anyway, my question is this, have I screwed something up in my CSS file, or maybe the HTML?

Any help would be much appreciated, many thanks in advance!

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>:: My Website ::</title>
<link rel="stylesheet" href="default.css"  type="text/css" />
</head>
<body>
<div class="container">
<div id="nav">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="index.html">Blog</a></li>
<li><a href="index.html">Forum</a></li>
</ul>
</div>
<div id="content">
This is some content.
</div>
<div id="footer">
Site coded and designed by Dean Hollstrom © 2007.
</div>
</div>
</body>
</html>



CODE


/* CSS Document */

/* Main font and color for page*/

p
    {
    font-family: calibri;
    }

background
    {
    }

/* list styles for the navigation menu and links */

a:link
    {
    text-decoration: none;
    color: #000000;
    font-family: calibri;
    }

a:visited
    {
    text-decoration:;
    }
    
a:hover
    {
    text-decoration: underline;
    }

a:active
    {
    }
    
ul
    {
    background: #99CCCC;
    list-style-type: none;
    width: auto;
    height: inherit;
    margin: 0px;
    padding: 0px;
    }

li
    {
    text-align: center;
    font-size: 15px;
    width: auto;
    margin: 0px;
    padding: 0px;
    display: inline;
    }

/* Main div elment and class styles */
    
.container
    
    {
    width: 800px;
    height: 1000px;
    padding: 0px;
    border: 1px solid #000000;
    margin: 0px auto;
    }
    
    
nav
    {
    border-bottom: 1px solid #000000;
    height: 200px;
    margin: 0px auto;
    padding: 3px;
    }

content
    {
    float:right;
    overflow: auto;
    height: 100%;
    width: 200px;
    padding: 5px;
    }
    
footer
    {
    background: #FFFFFF;
    clear: both;
    text-align: center;
    width: auto;
    height: 30px;
    border-top: 1px solid #000000;
    }


User is offlineProfile CardPM
+Quote Post

mhewson
RE: CSS Doesn't Seem To Be Affecting Divs
4 Jun, 2007 - 02:30 PM
Post #2

New D.I.C Head
*

Joined: 3 Jun, 2007
Posts: 3


My Contributions
You need to specify your IDs in the css file, this is done with the # key

for example to target your nav id it would be

#nav
{
}


if nav were a class and not an id it would be with the . key

.nav
{
}

Ids are only allowed once on a page and so are normally used for page structure elements while classes can be reused as often as needed.

hope this helps
User is offlineProfile CardPM
+Quote Post

dean.h
RE: CSS Doesn't Seem To Be Affecting Divs
5 Jun, 2007 - 02:58 AM
Post #3

New D.I.C Head
*

Joined: 4 Mar, 2007
Posts: 12


My Contributions
Many thanks, that's been driving me mad, never thought of using the # (mainly as I've been able to get away without using it before!)

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 08:15PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month