css - What the difference between two double point and one in pseudo-selector -
i bit not understand difference between :before
, ::before
example. 1 should use?
this differentiate between pseudo-classes (such :hover
, :focus
, :active
) , pseudo-elements (such ::before
, ::after
, ::first-line
).
this introduced part of css3, world wide web consortium (the w3c), because pseudo-elements introduced prior syntactic differentiation browsers support both ::before
, :before
.
according reference @ mdn (mozilla developer network):
browser | lowest version | support of -------------------+--------------------+------------------ internet explorer | 8.0 | :pseudo-element +--------------------+------------------ | 9.0 | :pseudo-element | | ::pseudo-element -------------------+--------------------+------------------ firefox (gecko) | 1.0 (1.0) | :pseudo-element +--------------------+------------------ | 1.0 (1.5) | :pseudo-element | | ::pseudo-element -------------------+--------------------+------------------ opera | 4.0 | :pseudo-element +--------------------+------------------ | 7.0 | :pseudo-element | | ::pseudo-element -------------------+--------------------+------------------ safari (webkit) | 1.0 (85) | :pseudo-element | | ::pseudo-element -------------------+--------------------+------------------
note, css selectors recommendation:
this
::
notation introduced current document in order establish discrimination between pseudo-classes , pseudo-elements.
compatibility existing style sheets, user agents must accept previous one-colon notation pseudo-elements introduced in css levels 1 , 2 (namely,:first-line
,:first-letter
,:before
,:after
).
compatibility not allowed new pseudo-elements introduced in specification.
references:
Comments
Post a Comment