1. 程式人生 > >[CSS3] Target HTML Elements not Explicitly set in the DOM with CSS Pseudo Elements

[CSS3] Target HTML Elements not Explicitly set in the DOM with CSS Pseudo Elements

border lose lac imp close election flex size selection

Pseudo elements allow us to target elements that are not explicitly set in the DOM. Using ::before ::after we can actually create and manipulate elements in the DOM that do not impact the content. While ::first-letter ::first-line ::selection ::placeholder allow us to target elements that do not have a specific DOM element.

About ‘blockquote‘:
blockquote {
  quotes: "“" "”" "‘" "’";
}

blockquote::before {
  content: open-quote;
}
blockquote::after {
  content: close-quote;
}

About ::first-line, ::first-letter:

p::first-line {
  color: green;
}

p::first-letter {
  font-size
: 2em; float: left; line-height: 1.7em; padding: 0 .3em; font-weight: bold; }

[CSS3] Target HTML Elements not Explicitly set in the DOM with CSS Pseudo Elements