Home > Web Front-end > HTML Tutorial > CSS style regular expression_html/css_WEB-ITnose

CSS style regular expression_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:41:01
Original
945 people have browsed it

I want to write such a style.
a0,a1,a2,a3
{
margin-top:5px;
}

But what if I have unlimited styles like this?
0~n styles starting with a? Am I not writing this to write about death?
Is there any simple way, other than JS, to write it directly in the CSS style sheet? How to do it?
For example, I want the style of a0~a100. How to write easier?


Reply to the discussion (solution)

Then on the other hand, they can use the same class name

You can change your mind and define A common class, and then apply this class on the required elements

Then just use a for these 100
If there are other needs such as a1-a10 a20-a50, each has different needs You can define different class names
so that there will not be so many

You can use the attribute selector [attr^=a], and the matching attribute is all elements starting with a.

Thank you everyone, I have used sass

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