我正在做一个学校项目,我必须创建一条水平线,上面有一些点。
我不能将 css 作为单独的文件使用。css 需要位于 HTML 标签内。
例如:
我已经创建了水平线,但无法在其上创建点。
这是我的解决方案:
.wraper {
padding: 50px;
text-align: center;
font-family: sans-serif;
width: 500px;
margin: 10px auto;
}
h1 {
margin: 50px auto;
}
.container {
border-top: 2px solid #000;
display: flex;
list-style: none;
padding: 0;
justify-content: space-between;
align-items: stretch;
align-content: stretch;
}
.link {
position: relative;
margin-top: 10px;
width: 100%;
}
.link a {
font-weight: bold;
text-decoration: none;
color: black;
text-transform: uppercase;
font-size: 15px;
}
.link:first-child {
margin-left: -55px;
}
.link:last-child {
margin-right: -55px;
}
.link::after {
content: "";
width: 10px;
height: 10px;
background: #fff;
position: absolute;
border-radius: 10px;
top: -18px;
left: 50%;
transform: translatex(-50%);
border: 2px solid black;
}
.active::after,
.link:hover::after {
background: black;
}
p.lead {
font-weight: 600;
margin: 50px auto;
line-height: 1.5;
}Run Code Online (Sandbox Code Playgroud)
<div class="wraper">
<h1>How We Work</h1>
<ul class="container">
<li class="link"><a href="">Identify</a></li>
<li class="link"><a href="">Form</a></li>
<li class="link active"><a href="">Develop</a></li>
<li class="link"><a href="">Launch</a></li>
<li class="link"><a href="">Grow</a></li>
</ul>
<p class="lead">A streamlined team of co-founders is brought together to create and lead the company, empowering a new generation of entrepreneurs.</p>
</div>Run Code Online (Sandbox Code Playgroud)
希望你需要它:)