How to insert content into the page in css3

PHP中文网
Release: 2017-06-22 11:38:13
Original
2026 people have browsed it

A Use selectors to insert content

h2:before{
  content:"前缀";
}
h2:after{
  content:"后缀";
}
Copy after login

B. Specify individual elements not to be inserted

h2.sample:before{
  content:none;
}
Copy after login

2. Insert images

A Insert image file before the title

h2:before{
  content:url(anwy.jpg);
}
Copy after login

B Display the value of the alt attribute as the title of the image (cannot be used)

img:after{
  content:attr(alt);
  display:block;
  text-align:center;
  margin-top:5px;
  font-size:11px;
  font-weight:bold;
  color:black;
}
Copy after login

3. Insert number

A Add consecutive numbers before multiple titles

p:before{
  content:counter(pCounter);
}
p{
  counter-increment:pCounter;
}
Copy after login

B Append text to bullets

p:before{
  content:"第"counter(pCounter)"段";
}
Copy after login

C Specify numbering style and type

p:before{
  content:counter(pCounter,upper-alpha)'.';
  color:blue;
  font-size:16px;
}
Copy after login

D Number nesting

p:before{
  content:counter(pCounter,upper-alpha)'.';
  color:blue;
  font-size:16px;
}
p{
  counter-increment:pCounter;
  counter-reset:subDivCounter;
}
p:before{
  content:counter(subDivCounter)'.';
  margin-left:15px;
 
  font-size:12px;
}
p{
  counter-increment:subDivCounter;
}
Copy after login

E Add text nesting symbols on both sides of the string

h3:before{
  content: open-quote;
}
h3:after{
  content: close-quote;
}
h3{
  quotes:"【""】";
}
Copy after login

disc Point| circlecircle | squaresquare | decimalnumber | decimal-leading-zero decimal number| lower-roman lowercase Roman text| upper-roman uppercase Roman script| lower-greeklower case Greek letter | lower-latinlowercase Latin | upper-latin uppercase Latin| armenianArmenia Number | georgianGeorgian number | lower-alphalowercaseEnglish letter | upper-alphauppercaseEnglish letter | none | inheritinherit

The above is the detailed content of How to insert content into the page in css3. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!