Front-End Interview

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).

posted @ 2015-05-25 08:56  Garret_lee  阅读(127)  评论(0编辑  收藏  举报