Tuesday, April 9, 2013

CSS Text Styling, Inheritance and Cascade, CSS Layout & Background Images

Last week we discussed and went over more CSS functions and how these features can make the "look" of your website stand out.
One major thing we learned was how inheritance is used within CSS. By using inheritance, we can structure the way we want our content to appear through the hierarchy of of inheritance. Let's say we wanted one paragraph to have a certain background color with a particular font color. Let's also say we have several h tags throughout the code. By adding a certain element to the "parental" tags, the element will then be passed down, or "inherited" by the "children" tags.
Another concept was that of the cascade. The Cascade controls the end result when you have multiple, conflicting CSS declarations that are being applied to the same element. There are 3 concepts that control the order in which the CSS declarations are applied and they are
1. Importance
2. Specificity
3. Source Order

Importance depends on where it is specified. For example,
p {  
font-family: "Comic Sans MS";
}

- VS -

p {
 font-family: "Comic Sans MS"
!important;
}
Specificity requires you to identify which part of the element you want to affect. ID tags can be used however they can only be used once. Attributes and Class are less specific and then element types are the least specific.
If two or more declarations are of the same importance and have the same specificty, the source order would then determine the end result. With source order, the declaration that appears last, will overtake the others. Therefore, the most recent code written on the bottom (the one which appears last) will have the final determination.
Another concept that was discussed was CSS styling regarding fonts. With fonts, you can change the size, the weight, height, variant, and everything that can aid in elaborating and drawing attention to specific words.

One thing CSS can also apply are margins and borders around your content. You can adjust the margins and create "padding" around paragraphs and content to highlight it in some sense.

Another way to highlight some content on your website is to use background images and then lay your content on top of that. This can help provide extra emphasis and subtext to your website and make it more aesthetically pleasing.

CSS can provide a variety of options to enable a functional, user-friendly, and fascinating website.
 


No comments:

Post a Comment