Basic CSS.

Joined
Jan 12, 2014
Messages
7
Reaction score
1
<!DOCOTYPE html>
<html>
<head>
<Title>Basic CSS</title>
<style>
* {
background-color: #555;
margin: 0px;
font-family: arial, helvetica, sans-serif;
}
#head {
background-color: black;
height: 56px;
}
#div, h1 {
color: white;
position: absolute; top: 5;
background-color: black;
margin-left: 500px;
}
p {


color: red;
position: absolute; top: 0px;
background-color: black;
</style>
</head>
<body>
<div id="head">
<h1>CSS</h1>
</div>




<p>Login || Sign up</p>


</body>
</html>

Any mistakes, please correct.
 
Other than a simple 'doctype' typo or matching of braces, I don't see anything wrong.

But the question is what is your objective for doing this?

If it's for learning and trial and error, you can go to hxxp://jsfiddle.net/ to test out your ideas.
 
You've referenced an unknown ID named div, you should correct it to:
Code:
div h1 {
// CSS
}

OR

Code:
#head h1 {
// CSS
}

Also the DOCTYPE typo, as previously mentioned.

Try also formatting your CSS a little bit better, for the sake of readability.

Edit: Also, change the * attribute to "body", for stuff like background colours and fonts. Simply because I consider it bad formatting. So do some other people:
http://css-tricks.com/forums/topic/the-selector/
http://stackoverflow.com/questions/1714096/why-is-the-css-star-selector-considered-harmful

It also can produce unexpected complications if you're trying to style individual elements later on.
 
Last edited:
I code differently that you, so i do not need to change anything.
 
I code differently that you, so i do not need to change anything.

Lol, you ask for advice, and then tell me you don't need to change anything?

You're welcome for the help kid. :fing02:
 
Last edited:
use general properties and colors inside body tag instead of assigning to *
 
Back
Top