ForumsProgramming ForumHTML/CSS Help

16 5476
mentorso123
offline
mentorso123
368 posts
Jester

I have a question on the subject of HTML.
Can you assign an "id" attribute to elements like <h1>(so that you can later define their specifics in a stylesheet?

  • 16 Replies
daegale
offline
daegale
2 posts
Nomad

yes you can but i think it would be beter if you replace it with the size property in the style of the label

kingryan
offline
kingryan
4,196 posts
Farmer

Oh no Look it is Mentorso,
The lost writer is now found.
But as you can see in HTML he is buried,
Far far underground.

This HTML I have not heard of,
I have only basic knowledge.
I want to learn it but I am slow,
To climb over that first big hedge.

mentorso123
offline
mentorso123
368 posts
Jester

Like on the Armor Games home page, the Armor Games link (white) is heading 1 and the New Games is also H1, but they look completely different.

anatolytt
offline
anatolytt
64 posts
Peasant

Then probly their styles are assigned via nesting selectors that looks like that:

.menu h1 {text-color:white;}
.text h1 {text-color:black;}

That tells browser to display any <h1> found inside a container with "menu" class in black, and <h1>'s found inside a container with "text" class in black.

<div class="menu"><h1>White text</h1></div>
<div class="text"><h1>Black text</h1></div>

anatolytt
offline
anatolytt
64 posts
Peasant

Ofcourse i mean "...found inside a container with "menu" class in WHITE", that was just a typo

mentorso123
offline
mentorso123
368 posts
Jester

Also, I'm having a problem where I have an h1 in a div which is fine, except the h1 text is one line in to the div as opposed to being at the top.

mentorso123
offline
mentorso123
368 posts
Jester

I've tried a lot of different things and I'm getting pretty annoyed, anyone know why this is happening?

Aaroniscool
offline
Aaroniscool
254 posts
Nomad

One thing to make sure you do is separeate each attribute in your style sheet with a semicolon

I.e.

p.bluetext { color: Blue ;
font-family: Arial ;
}

something like that...

alt_account
offline
alt_account
263 posts
Nomad

how do you make an external style sheet?

anatolytt
offline
anatolytt
64 posts
Peasant

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

put that inside the <head> container

alt_account
offline
alt_account
263 posts
Nomad

you need underscores for every space on the name of the file?

anatolytt
offline
anatolytt
64 posts
Peasant

mentorso123, position the text as u like by setting an align attribute of div, or position/margin etc attributes of your h1 tag

anatolytt
offline
anatolytt
64 posts
Peasant

alt_account, you need to specify a path to your css file

mentorso123
offline
mentorso123
368 posts
Jester

Also, does anyone know how to make the wrapper not have a space at the top and bottom? It sort of ruins the white space.

anatolytt
offline
anatolytt
64 posts
Peasant

margin:0 probably?

Showing 1-15 of 16