<div id=????> help me id the "id"

liunx

Guest
:( im confused, you need an id , for the div command to work?
whats an id.. from what i readed.... thats just hwo you define a different style for the same tag!

so i saw... <div id="scissors">.. but the id part, that tell's the div what to do . am i right?or wrong?
so do you make up the id yourself.. by using a stle sheet? or is there set id's for the div?

damm... who knew that learnign this yourself.. was so damm hard! :confused:
if the id's are set for different meanings.. wher ecan i get them? :(
please have paitence!!! with me? please?

i feel liek cryingNo. Divs do not need ids. An id is, essentially, the name of the div. You can give a div an id if you wish but it's not required.

If you give a div an id then only one div can have that id (name). Otherwise a stylesheet would not know which div to style according to its name.

You can use any name (id) you wish as long as it doesn't start with a number.Eventually you'll come upon 'classes'. A class is also a name but this time it's the name of a group. You can assign as many divs as you wish to the same group (class) as long as they all have the same name. All divs in the same class get styled by stylesheets the same way.

So, ids are names of individual elements. Classes are names for groups of elements.If you use a "#" selector in your CSS, such as "h1#foo" or just "#bar", then the attributes you define for that selector will apply to the appropriate HTML element with a corresponding ID:

CSS

h1#foo { font-size: x-large; }
#bar { color: blue; }

HTML

<h1 id="foo">This text would be x-large</h1>
<p id="bar">This text would be blue</p>

If you replace the "#" with "." in the above CSS, then you would reference it in your HTML as <h1 class="foo"> or <p class="bar"> instead. ID's are intended to be used for only one specific element within your HTML, while classes can be used in any number of applicable elements.
 
Back
Top