The Universal Selector
In the first step of this exercise we were introduced to the
universal selector
. In CSS the asterisk, *
, is the universal selector, which selects every element. Rather than listing every single element imaginable, we can use the asterisk as a catch-all to select all elements for us.
The
:before
and :after
pseudo-elements also mentioned in this step are elements that can be dynamically generated with CSS. We’re not going to be using these elements within our project; however, when using the universal selector it’s a good practice to also include these pseudo-elements in case they should ever appear.- From there, we can use the universal selector,
*
, along with universal pseudo-elements,*:before
and*:after
, to select every imaginable element and change thebox-sizing
toborder-box
. Remember, we’re going to want to include the necessary vendor prefixes for thebox-sizing
property, as it is a relatively new property.1 2 3 4 5 6 7 8 9 10 11 12 13 14
/* ======================================== Grid ======================================== */ *, *:before, *:after { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
- Next we’ll want to create a class that will serve as a container for our elements.
No comments:
Post a Comment