Sunday, 6 November 2016

CSS Selectors

In CSS, apart from just declaring the element selector, you can declare a specific element. For example, if I have many <p> elements and I only want to select a certain <p> element, I can use a specific selector. There is a number of ways of doing this. The first way is to call on the elements id.
I do this by using the hashtag symbol (#), followed by the id name. See the syntax below:


This will also effect every element containing the id "para1" so be careful!

The second way to declare specific element selector is by calling on the class of the element. This is done by placing a .(dot) in front of the class name. This technique is used when you have a group of elements you would like to change. See example below:


No comments:

Post a Comment