I'm still confused on the part where class and id differ


#1

Ok, I'm still confused on the part where class and id differ. Can someone try to explain that??


Lesson 13, add an ID to <h2> error
#2

@coreblaster51147

HTML Elements can also carry attribute's
like:
the **id="id-name-as-string"
the **class="class-name1 class-name2"

In the Cascading Style Sheet syntax,
you have to prepend-a-dot to the classname
so the CSS will interpret it as a class-attribute
So in the file style.css you will find an object
identified by .class-name1
OR
the Cascading Style Sheet syntax,
you have to prepend-a-hash to the id-name
so the CSS will interpret it as an id-attribute
So in the file style.css you will find an object
identified by #id-name-as-string

An object is encapsulated in a pair of curly-brackets-{ }
and contains one or more properties.
Each property consists of a property-key and it's associated Value
A property-definition is terminated with a semi-colon-;

Thus in your style.css file you would have an object

#id-name-as-string {
   color: green;
}
.class-name1 {
   color: red;
}

You could also present the color-Value
in the so-called Red Green Blue format.
Depending on the Browser you use
[255,255,255] for white
or
#FFFFFF for white

Thus you could have used

#id-name-as-string {
   color: #00FF00;
}
.class-name1 {
   color: #FF0000;
}

Reference::

google search
class site:jquery.com
https://api.jquery.com/category/selectors/
http://api.jquery.com/class-selector/
https://api.jquery.com/element-selector/
http://www.w3schools.com/jquery/jquery_ref_selectors.asp
http://www.w3schools.com/jquery/trysel.asp

what is CSS explained site:developer.mozilla.org
https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started/What_is_CSS
https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity

http://stackoverflow.com/questions/1795438/load-and-execution-sequence-of-a-web-page


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.