简体   繁体   English

如何使用HTML CSS绘制线条?

[英]How do i draw lines with HTML CSS?

I have made this layout for my page. 我已经为我的页面设置了这种布局。

在此处输入图片说明

with this css 与此CSS

.carousel-indicators {
  position: absolute;
  top: 30%;
  left: 68%;
  z-index: 15;
  width: 60%;
  padding-left: 0;
  margin-left: -30%;
  text-align: center;
  list-style: none;
}
.carousel-indicators li {
  display: inline-block;
  width: 40px;
  height: 40px;
  margin-right: 40px;
  text-indent: -999px;
  cursor: pointer;
  background-color: #000 \9;
  background-color: rgba(0, 0, 0, 0);
  border: 2px solid #527BBD;
  border-radius: 50px;
}
.carousel-indicators .active {
  width: 42px;
  height: 42px;
  margin-right: 40px;
  background-color: #D91C23;
}

However, I need to create a slider coin with connecting lines like this: 但是,我需要使用如下连接线来创建滑块硬币:

在此处输入图片说明

can anyone help? 有人可以帮忙吗? thanks in advance! 提前致谢!

Since SVG was mentioned, here just an example: 由于提到了SVG,因此这里仅举一个例子:

 <svg> <rect x=20 y=20 width=210 height=1 style=stroke:grey /> <circle cx=20 cy=20 r=10 stroke=black stroke-width=1 fill=white /> <circle cx=90 cy=20 r=10 stroke=black stroke-width=1 fill=red /> <circle cx=160 cy=20 r=10 stroke=black stroke-width=1 fill=white /> <circle cx=230 cy=20 r=10 stroke=black stroke-width=1 fill=white /> </svg> 

hr {
    display: block;
    height: 1px;
    border: 0;
    border-top: 1px solid #ccc;
    margin: 1em 0;
    padding: 0;
}

and in your html file 并在您的html文件中

<div>foo</div>
<hr/>
<div>bar</div>

You could just do it in SVG. 您可以在SVG中完成。 It's reactive to DOM events just like HTML.You can even use SVG in jQuery 它像HTML一样对DOM事件起反应,甚至可以在jQuery中使用SVG

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM