CSS(Cascading Style Sheets)是前端开发中必不可少的一项技术,它为网页赋予了更加优秀的视觉效果和用户体验。下面就是一些CSS中常用词汇的介绍。 // 选择器 div, p, h...
CSS(Cascading Style Sheets)是前端开发中必不可少的一项技术,它为网页赋予了更加优秀的视觉效果和用户体验。下面就是一些CSS中常用词汇的介绍。
// 选择器
div, p, h1 {
color: blue;
}
/* 属性 */
font-size: 16px;
border: 1px solid #000;
background-color: #fff;
// 值
color: red;
padding: 20px;
margin-top: 10px;
/* 盒模型 */
.box {
width: 100px;
height: 100px;
padding: 10px;
border: 1px solid #000;
margin: 20px;
}
/* display属性 */
display: block;
display: inline;
display: inline-block;
// 定位
position: relative;
position: absolute;
position: fixed;
/* 伪类 */
a:hover {
color: red;
}
input:focus {
background-color: #ccc;
}
/* 媒体查询 */
@media only screen and (max-width: 768px) {
/* 样式 */
}
/* 动画 */
@keyframes move {
from {
left: 0;
}
to {
left: 100px;
}
}
.box {
animation: move 1s linear infinite;
}
// 继承性
.parent {
color: green;
}
.child {
/* 继承父元素color属性 */
} 以上就是CSS中常用的一些词汇的介绍了。了解这些词汇可以帮助我们更好地理解样式的使用和优化,从而打造更加优秀的网页。