<分区>
<分区>
是否有一些方法可以将 css 放入 html 中?我的意思是例如选择器,例如“之前:”和“之后:”
<div id="foto" style="position: relative; margin: 20px auto: with: 500px;heght:200px......">
<img src="imgt/big.jpg" width="500px" height="200px">
</div>
这是css文件
#foto{
position: relative;
margin: 20px auto;
width: 500px;
height: 200px;
padding: 10px;
border: 1px solid #ccc;
background: #eee;
}
#foto:before{
content: "";
position: absolute;
z-index: -1;
left: 10px;
bottom: 15px;
width: 50%;
height: 20%;
box-shadow: 0 15px 10px rgba(0,0,0,0.7);
-webkit-transform: rotate(-3deg);
}
#foto:after{
content: "";
position: absolute;
z-index: -1;
left: 250px;
bottom: 15px;
width: 50%;
height: 20%;
box-shadow: 0px 15px 10px rgba(0,0,0,0.7);
-webkit-transform: rotate(5deg);
最佳答案
您可以像在 div 中使用的那样使用内联样式。但是为什么你需要这样做呢?将 css 保存在单独的文件中始终是更好的做法。
正如 Zenith 所说,您不能在内联样式中使用伪元素。 See this
关于html - 有什么方法可以将 css 放入 html 中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16634051/