微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在线的中间画一条线

如何解决在线的中间画一条线

enter image description here

我想知道如何使用 CSS(3)(如果需要,使用 javascript)实现此图像。

有什么想法吗?

解决方法

有很多方法可以做到这一点 - 但由于您的线条高度超过 1 个像素,并且在两条线的两端都有圆形末端 - 我会将它作为 <table> <tfoot> <tr class="cart-subtotal"> <th>مجموع سبد خرید</th> <td><span class="woocommerce-Price-amount amount"><bdi>۱۲۳,۰۰۰<span class="woocommerce- Price-currencySymbol">تومان</span></bdi></span></td> </tr> <tr class="woocommerce-shipping-totals shipping"></tr> <tr data-title="حمل و نقل"></tr> <tr id="shipping_method" class="woocommerce-shipping-methods"></tr> <tr class="titleshippng"> <td> <h4>انتخاب شیوه ارسال</h4> </td> <td> </td> </tr> <tr class="shipmethod"><td><input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_flat_rate1" value="flat_rate:1" class="shipping_method" checked="checked"><label for="shipping_method_0_flat_rate1">پیک موتوری ( فقط برای شهر تهران - مدت زمان تحویل مرسوله حداکثر یک روز کاری): <span class="woocommerce-Price-amount amount"><bdi>۱۵,۰۰۰<span class="woocommerce-Price-currencySymbol">تومان</span></bdi></span></label></td><td></td></tr> <tr class="shipmethod"><td><input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_flat_rate2" value="flat_rate:2" class="shipping_method"><label for="shipping_method_0_flat_rate2">پست سفارشی ( مدت زمان تحویل مرسوله ۳ الی ۷ روز کاری): <span class="woocommerce-Price-amount amount"><bdi>۱۳,۰۰۰<span class="woocommerce-Price-currencySymbol">تومان</span></bdi></span></label></td><td></td></tr> <tr class="shipmethod"><td><input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_flat_rate3" value="flat_rate:3" class="shipping_method"><label for="shipping_method_0_flat_rate3">پست پیشتاز ( مدت زمان تحویل مرسوله ۲ الی ۴ روز کاری): <span class="woocommerce-Price-amount amount"><bdi>۱۸,۰۰۰<span class="woocommerce-Price-currencySymbol">تومان</span></bdi></span></label></td><td></td></tr> <tr class="shipmethod"><td><input type="radio" name="shipping_method[0]" data-index="0" id="shipping_method_0_flat_rate5" value="flat_rate:5" class="shipping_method"><label for="shipping_method_0_flat_rate5">پیک فوری یک الی دو ساعته ( فقط برای شهر تهران در روز و ساعت کاری - هزینه پیک در مقصد و از مشتری دریافت میشود.)</label></td><td></td></tr> <tr class="order-total"> <th>مجموع</th> <td><strong><span class="woocommerce-Price-amount amount"><bdi>۱۳۸,۰۰۰<span class="woocommerce-Price-currencySymbol">تومان</span></bdi></span></strong> </td> </tr> </tfoot> 使用居中文本。>

请注意,当使用 position:absolute 定位元素时 - 您需要应用 position: relative 相对于父元素。同样 - 您需要将线伪元素偏移其高度的一半 - 以便将它们垂直居中。

::before and ::after pseudo-elements
.wrapper {
 text-align: center;
 position: relative;
}

span {
  display: inline-block;
  width: 10%;
  font-size: 20px;
  font-weight: bold
}

.wrapper::before,.wrapper::after {
  content: ' ';
  display: block;
  position: absolute;
  top: calc(50% - 3px);
  width: 45%;
  background: black;
  border-radius: 6px;
  height: 6px;
}

.wrapper::after {
 right: 0;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?