Leak Society - The Home Of Nulled Resources.
Forum Beta v1 Now Live!
[CSS] Selectors, Properties, and Values
Thead Owner : Lord Royal, Category : Everything Coding, 1 Comment, 18 Read
Viewers: 1 Guest(s)
Senior Member
****
647
Messages
101
Threads
0
Rep
4 Years of Service
03-04-2014, 02:46 AM
#1
Whereas HTML has tags, CSS has selectors. Selectors are the names given to styles in internal and external style sheets. In this CSS Beginner Tutorial we will be concentrating on HTML selectors, which are simply the names of HTML tags and are used to change the style of a specific type of element.

For each selector there are “properties” inside curly brackets, which simply take the form of words such as color, font-weight or background-color.

A value is given to the property following a colon (NOT an “equals” sign) and semi-colons separate the properties.


body {
font-size: 14px;
color: navy;
}
This will apply the given values to the font-size and color properties to the body selector.

So basically, when this is applied to an HTML document, text between the body tags (which is the content of the whole window) will be 14 pixels in size and navy in color.

Lengths and Percentages

There are many property-specific units for values used in CSS, but there are some general units that are used by a number of properties and it is worth familiarizing yourself with these before continuing.

px (such as font-size: 12px) is the unit for pixels.
em (such as font-size: 2em) is the unit for the calculated size of a font. So “2em”, for example, is two times the current font size.
pt (such as font-size: 12pt) is the unit for points, for measurements typically in printed media.
% (such as width: 80%) is the unit for… wait for it… percentages.
Other units include pc (picas), cm (centimeters), mm (millimeters) and in (inches).

When a value is zero, you do not need to state a unit. For example, if you wanted to specify no border, it would be border: 0.

“px” in this case, doesn’t actually necessarily mean pixels - the little squares that make up a computer’s display - all of the time. Modern browsers allow users to zoom in and out of a page so that, even if you specify font-size: 12px, or height: 200px, for example, although these will be the genuine specified size on a non-zoomed browser, they will still increase and decrease in size with the user’s preference. It’s a good thing. Trust me.
Administrators
LeakSociety Owner
*****
7,137
Messages
1,907
Threads
4
Rep
2 Weeks
03-04-2014, 04:09 AM
#2
You're really blasting these out, good job with them!
Forum Owner


Forum Jump: