Monday, November 20, 2017

Uki2 Class 11 - Div,Id and Class Discussion & CSS Exercise

Id Class and Div

In CSS Id, Class and Div different kind of attributes are found. When writing CSS
we denote # before a word is to indicate that is an ID
and . to indicate that it is class.

The div tag is used to divide up the page into sections, for organizational purposes and to help you style sections of the page differently. Class and ID are attributes that you can apply to different elements, including div elements, so you can select them with CSS to apply styles that you specify for that class or ID.
Use ID if there's only one element on your page that's going to be styled a certain way (there should only be one element corresponding to each ID that you use) and use class if you want to apply the same styles to multiple elements.

IDs - can only be used once within the page and help pinpoint a specific item,
IDs can be targeted using things like CSS or Javascript, and can be used
on any item you wish to target.

ID's are unique
Each element can have only one ID
Each page can have only one element with that ID

Class - can be used over and over to target parts of your page,
Classes are NOT unique
You can use the same class on multiple elements.
You can use multiple classes on the same element.

We did an exercise to create a site with multiple HTML, CSS coding...


No comments:

Post a Comment