在CSS中,常用到的行为包括:
/* 选择器 */
.class {
/* 属性 */
color: red;
}
/* 盒子模型 */
.box {
width: 200px;
height: 200px;
padding: 10px;
border: 1px solid black;
margin: 20px;
}
/* 盒子布局 */
.container {
display: flex;
justify-content: center;
align-items: center;
}
/* 文本样式 */
p {
font-size: 18px;
font-weight: bold;
line-height: 1.5;
text-align: center;
text-shadow: 1px 1px black;
}
/* 背景样式 */
body {
background-color: gray;
background-image: url('bg.jpg');
background-size: cover;
}
/* 动画效果 */
.animation {
animation-name: fade-in;
animation-duration: 2s;
}
@keyframes fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
} 以上是CSS中常用的行为,开发者可根据需要进行选择和使用,以达到最佳的视觉效果。