今天学习css的时候遇到一个表达式:[class*=“col-”] {…},看半天没看明白,后来查阅了资料发现这是一个正则的css表达式,意思是对所有的以col-开头的都遵循括号内的样式。
举个例子:
<head>
<style>
[class*="col-"] {
float:center;
padding:15%;
}
.col-1{width:8.33%;}
.col-2{width:16.66%}
...
...
</style>
</head>
<body>
<div class="col-2">
<h1>The way<h1>
<p>Resize the browser window to see how the content respond to the resizing</p>
</div>
上面p标签和h标签继承了css正则表达式样式。