mkd mkd - 6 days ago 7
HTML Question

Css Code was not working

When I was styling the homepage with css everything was going good and now that I am trying to change some styles , the css isn't working .

I've tried a few css validator's and fixed what they told me to fix and nothing worked . What is wrong with my code ?

css.css :

nav {
background-color: #20B2AA;
padding-bottom: 180px;
margin-top: -10px;
position: absolute;

}
h1 {
float:left;
top: 15;
left: 69;
position: absolute;
}
h3 {
float:left;
top: 125;
right: 169;
position: absolute;
}
h2 {
float:left;
top: 160;
left: 79;
position: absolute;
font-size: 220%;

}
p5 {
float:left;
top: 230;
left: 80;
position: absolute;
font-size: 160%;
}
p6 {
float:left;
top: 290;
left: 80;
position: absolute;
font-size: 160%;

}
p7 {
float:left;
top: 350;
left: 80;
position: absolute;
font-size: 160%;

}
div {
float:left;
top: 235;
right: 169;
position: absolute;
}
nav p {
float:right;
top: 50;
left: 960;
position: absolute;
}
p2 {
top: 50;
left: 740;
position: absolute;
}
p3 {
top: 80;
left: 960;
position: absolute;
}
p4 {
top: 50;
left: 1200;
position: absolute;
}
Register{
background-color: #5fcf80;
border-color: #3ac162;
}


index.php(link to css) :

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

Answer

Some things to consider:

  • Classes go with .class {property: value;} (I'm assuming all those p# would be classes?)
  • IDs go with #id {property: value;}
  • Add "px" units to top bottom left & right properties (E.g. top: 290px;)
  • Register would be a class as well? (.Register {property: value;})
  • Also try to avoid using the same filename as the extension css.css would be best styles.css or something similar.
Comments