在网页设计中,分割线的作用很大,可以分割不同的模块,使网页更加美观。那么,在CSS中如何写分割线呢?首先,我们可以使用border属性来实现分割线的效果。下面是一个例子:p { borderbotto...
在网页设计中,分割线的作用很大,可以分割不同的模块,使网页更加美观。那么,在CSS中如何写分割线呢?
首先,我们可以使用border属性来实现分割线的效果。下面是一个例子:
p {
border-bottom: 1px solid black;
} p {
position: relative;
}
p:after {
content: ';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 1px;
background-color: black;
} p {
background: linear-gradient(to right, black, white 50%, black);
background-position: 0 100%;
background-size: 100% 1px;
background-repeat: no-repeat;
}