Web Design

(Nancy Kaufman) #1

140


Use Pseudo-Elements .............................................


2 Within the style sheet, type
the name of an element.


3 Type a colon.


4 Type the pseudo-element you
want to use.


1 In your editor, open a page
that contains an embedded
style sheet.


Use Pseudo-Elements


A


pseudo-element is a special selector type in CSS that allows you to target an element in special
situations. For example, you can use the :first-line pseudo-element to apply a style only

to the first line of an element, whereas the first-letter pseudo-element applies to the first character


within the specified element. The pseudo-element is separated from the element by a colon, so to


style the first line of a paragraph, you would use p:first-line. CSS also recognizes a before-


and-after pseudo-element, but some browsers do not properly support them.


3


4


1


2

Free download pdf