CSS之前和之后

时间:2017-10-04 05:06:35

标签: css

http://selenium-python.readthedocs.io/api.html HTML:

<h3> <span>What have you missed </span></h3>

CSS:

h3 {color:#c8352e; text-transform:uppercase; font-size:20px; font-weight:900; font-family:arial,'sans-serif'; position:relative; padding-left:22px;}

    h3:before, h3:after {position: absolute; content: ""; height: 4px; top: 50%; border-top:1px solid #ccc; border-bottom:1px solid #ccc; }
    h3:before {width:15px; left:0;}
    h3:after {width:60%;}
    h3 span {display: inline-block;padding-right: 10px;}

在css的帮助下我需要这些线条效果。 enter image description here

5 个答案:

答案 0 :(得分:1)

一点点改变可能是精度和生产标签输出

&#13;
&#13;
h3 {
  color: #c8352e;
  text-transform: uppercase;
  font-size: 20px;
  font-weight: 900;
  font-family: arial, "sans-serif";
  position: relative;
  padding-left: 22px;
}

h3::before,
h3::after {
  position: absolute;
  content: "";
  height: 2px;
  top: 50%;
  border-top: 4px double #ccc;
  border-bottom: 1px solid #ccc;
}

h3::before {
  width: 15px;
  left: 0;
}

h3::after {
  width: 50%;
}

h3 span {
  display: inline-block;
  padding-right: 10px;
  position: relative;
  top: 3px;
}
&#13;
<h3><span>What have you missed </span></h3>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

我使用了double而不是solid.Hope这有帮助。

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<style>
h3 {color:#c8352e; text-transform:uppercase; font-size:20px; font-weight:900; font-family:arial,'sans-serif'; position:relative; padding-left:22px;}

    h3:before, h3:after {position: absolute; content: ""; height: 4px; top: 50%; border-top: 4px double #ccc; border-bottom:1px solid #ccc; }
    h3:before {width:15px; left:0;}
    h3:after {width:60%;}
    h3 span {display: inline-block;padding-right: 10px;}
   
</style>
<body>
<h3 ><span>What have you missed </span></h3>
</body>
</html>

答案 2 :(得分:0)

Another way

.subtitle {
  margin: 0 0 2em 0;
}
.fancy {
  line-height: 0.5;
  text-align: center;
}
.fancy h3 {
  display: inline-block;
  position:absolute;
  left:30px;
}
.fancy h3::before,
.fancy h3::after {
  content: "";
  position: absolute;
  height: 5px;
  border-bottom: 1px solid #ddd;
  border-top: 1px solid #ddd;
  top: 0;
  width: 600px;
}
.fancy h3::before {
  right: 100%;
  margin-right: 15px;
}
.fancy h3::after {
  left: 100%;
  margin-left: 15px;
}
<div class="subtitle fancy"><h3>what have you missed!</h3></div>

答案 3 :(得分:0)

最佳方法&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;

你错过了什么!

.subtitle {
  margin: 0 0 2em 0;
}
.fancy {
  line-height: 0.5;
  text-align: center;
}
.fancy h3 {
  display: inline-block;
  position:absolute;
  left:30px;
}
.fancy h3::before,
.fancy h3::after {
  content: "";
  position: absolute;
  height: 5px;
  border-bottom: 1px solid #ddd;
  border-top: 1px solid #ddd;
  top: 0;
  width: 600px;
}
.fancy h3::before {
  right: 100%;
  margin-right: 15px;
}
.fancy h3::after {
  left: 100%;
  margin-left: 15px;
}

https://codepen.io/Thakur92411/pen/yzPJbO

答案 4 :(得分:0)

CSS beforeafter就像这样工作

Selector :: before {CSS here}所以你的CSS应该是这样的

h3 {color:#c8352e; text-transform:uppercase; font-size:20px; font-weight:900; font-family:arial,'sans-serif'; position:relative; padding-left:22px;}

h3::before, h3::after {position: absolute; content: "g"; height: 4px; top: 50%; border-top:10px solid #ccc; border-bottom:10px solid #ccc; color:blue; }
 h3 ::before {width:15px; left:0;}
h3 ::after {width:60%;}
h3 span {display: inline-block;padding-right: 10px;}