将邮政编码转换为';正常';CSS
我有一段用postsss设计的代码。现在我想在“普通”CSS中实现同样的效果,而不使用PostCSS插件。这是否可能?如果可能,如何实现 这听起来可能是个愚蠢的问题,但我对HTML/CSS还不熟悉 代码位于代码笔上: 以下是HTML:将邮政编码转换为';正常';CSS,css,postcss,Css,Postcss,我有一段用postsss设计的代码。现在我想在“普通”CSS中实现同样的效果,而不使用PostCSS插件。这是否可能?如果可能,如何实现 这听起来可能是个愚蠢的问题,但我对HTML/CSS还不熟悉 代码位于代码笔上: 以下是HTML: <p> "Attractive things make people </a> <a class="link-1" href="#">feel good</a>, which in turn makes them
<p>
"Attractive things make people </a> <a class="link-1" href="#">feel good</a>, which in turn makes them think more</a> <a class="link-1" href="#">Creatively</a>. How does that make something easier to use? Simple, by making it easier for <a class="link-2">people</a> to find solutions to the problems they encounter." <strong>- Don Norman</strong>
</p>\
这是可能的,因为浏览器只理解纯CSS。如果您使用的是诸如postss(或SASS、LESS、Stylus…)之类的预处理器,则需要一个编译器,将特定于语言的样式声明转换为纯CSS。由于您提到了CodePen,CSS窗口右上角甚至有一个下拉菜单,您可以在其中选择“查看已编译的CSS”,这将为您提供以下结果:
@import 'https://fonts.googleapis.com/css?family=Open+Sans';
* {
box-sizing: border-box;
}
html, body {
font-family: 'Open Sans', sans-serif;
width: 100%;
height: 100%;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
body {
border: 8px solid #00458D;
}
a {
cursor: pointer;
}
strong {
margin-top: 16px;
display: block;
font-weight: 700;
}
p {
padding: 24px;
max-width: 760px;
font-size: 16px;
font-weight: 500;
line-height: 24px;
}
.link-1 {
position: relative;
text-decoration: none;
display: inline-block;
color: #00458D;
padding: 0 1px;
-webkit-transition: color ease 0.25s;
transition: color ease 0.25s;
}
.link-1::after {
content: '';
position: absolute;
z-index: -1;
width: 100%;
height: 1px;
left: 0;
bottom: 0;
background-color: #00458D;
-webkit-transition: all ease 0.25s;
transition: all ease 0.25s;
}
.link-1:active {
position: relative;
text-decoration: none;
display: inline-block;
background-color: #D42E1C;
}
.link-1:hover {
color: white;
}
.link-1:hover::after {
height: 100%;
}
您可能需要阅读,以便更好地了解如何使用CSS预处理器以及它们的作用
@import 'https://fonts.googleapis.com/css?family=Open+Sans';
* {
box-sizing: border-box;
}
html, body {
font-family: 'Open Sans', sans-serif;
width: 100%;
height: 100%;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
body {
border: 8px solid #00458D;
}
a {
cursor: pointer;
}
strong {
margin-top: 16px;
display: block;
font-weight: 700;
}
p {
padding: 24px;
max-width: 760px;
font-size: 16px;
font-weight: 500;
line-height: 24px;
}
.link-1 {
position: relative;
text-decoration: none;
display: inline-block;
color: #00458D;
padding: 0 1px;
-webkit-transition: color ease 0.25s;
transition: color ease 0.25s;
}
.link-1::after {
content: '';
position: absolute;
z-index: -1;
width: 100%;
height: 1px;
left: 0;
bottom: 0;
background-color: #00458D;
-webkit-transition: all ease 0.25s;
transition: all ease 0.25s;
}
.link-1:active {
position: relative;
text-decoration: none;
display: inline-block;
background-color: #D42E1C;
}
.link-1:hover {
color: white;
}
.link-1:hover::after {
height: 100%;
}