TAILIEUCHUNG - The CSS Anthology: 101 Essential Tips, Tricks & Hacks- P3

The CSS Anthology: 101 Essential Tips, Tricks & Hacks- P3:Apart from writing books like this one, I write code. I make my living by building web sites and applications as, I’m sure, many readers of this book do. I use CSS to complete jobs every day, and I know what it’s like to struggle to make CSS work when the project needs to be finished the next morning. | Making a Start with CSS 17 The four selectors above all match the paragraph element in the example HTML and set the text color. What color will be applied to the paragraph If you guessed FF0000 or red you d be right. The selectors p any p element and .message any element with class message have the same amount of specificity the selector any p element with class message has a higher level of specificity but the selector content any p element with class message that is a child of the element with id content has the highest. However longer selectors are not necessarily more specific. An ID selector for example will always have a higher specificity than an element type or class selector. It becomes trickier the more complex your selectors are but you should find the examples in this book simple enough. If you d like to know the exact formula for measuring specificity the SitePoint CSS Reference3 has all the answers. If after all of the above have been taken into account two or more style rules are still applicable to an element then the order in which the rules appear the source order is used the last rule to be declared is applied. In the above example the selectors p and .message have the same specificity so in the absence of any other applicable rules the last one declared is used the rule with the selector .message. This is also true if you declare more than one style rule with the same selector .message for example in your style sheet it ll be the second instance of that rule that will be applied to the element. As we ll see in later chapters this behavior is very useful. Summary This chapter has given you a taste of CSS and its usage at the most basic level. We ve even touched on the sometimes difficult concept of the cascade. If you re a newbie to CSS but have an understanding of the concepts discussed in this chapter you should be able to start using the examples in this book. The examples in the early chapters are simpler than those found

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.