1. what is the difference between classes and ID's in CSS?
A: ID's are unique:
Each element can only have one ID
Each page can only have one elemetn with that ID
Classes are not unique:
You can use the same class on multiple elements
You can use multiple classes on the same elements.
Classes are good when setting styles on a group of elements. ID's are good when manipulate single element.
2. What is the difference between "resetting" and "normalizing" CSS? Which would you choose, and why?
A: /*CSS reset: is a short rules that resets the styling of all HTML elements to a consistent baseline so that the default rending of HTML by different browsers couldn't touch.*/
Reset is to reset everything.stripping away all the default rendering.
normalizing: allowing certain elements like the headers, ordered lists, block quotes ,forms and many other simple things to be left alone.
3. Describe Floats and how they work
A: floats have four values
left
right
none: ensures the element will not float
inherit: will assume the float value from that element's parent element.
4. Describe z-index and how stacking context is formed.
The z-index property in CSS controls the vertial stacking order of elements overlap. z-index only effects element that have a "position" value other than static(the default).
本文深入解析CSS中ID与类的区别,包括它们的独特性、使用场景及如何在网页布局中灵活运用。同时,介绍了CSS重置与正常化概念,以及浮动与堆叠上下文的概念,为网页设计师提供实用的CSS样式设计指南。
501

被折叠的 条评论
为什么被折叠?



