要将这条直线变为竖立的,可以通过修改样式中的width
和height
属性来实现。将width
设置为2px,将height
设置为230px,并且将其旋转90度即可。具体的CSS代码如下所示:
<style>
.vertical-line {
position: absolute;
width: 2px;
height: 230px;
background-color: black;
z-index: 1;
margin-top: 505px;
margin-left: 1190px;
transform-origin: top left; /* 设置旋转的原点在左上角 */
transform: rotate(90deg); /* 将元素旋转90度 */
}
</style>
<span class="vertical-line"></span>
通过以上代码,你可以把水平的直线变为竖立的直线。
内容由零声教学AI助手提供,问题来源于学员提问