css 箭头作为伪元素之前和之后

Fjo*_*ott 1 html css pseudo-element

在下面的代码中,我有两个箭头指向我的 SoMe div,只要页面不调整大小,箭头就会附加到边框。

\n\n

调整大小后,它会成为箭头和边框之间的空格。\n我希望可以将箭头添加为前后伪元素,而不是使用媒体查询。div.front-some:before但是当将箭头类别更改为和时,我没有设法使箭头出现div.front-some:after

\n\n

这是否有可能实现,或者媒体查询是我唯一的选择?

\n\n

\r\n
\r\n
  body {\r\n\t  background: green;\r\n\t}\r\n\r\n\th1.title {\r\n\t  color: red;\r\n\t  text-align: center;\r\n\t  text-transform: uppercase;\r\n\t  letter-spacing: 20px;\r\n\t  background: green;\r\n\t  max-width: 70%;\r\n\t  margin: -40px auto 0 auto;\r\n\t}\r\n\r\n\tdiv.inner {\r\n\t  border: 4px solid red;\r\n\t  color: #fff;\r\n\t  padding: 15px 50px 50px 50px;\r\n\t  margin-top: 100px;\r\n\t  box-sizing: content-box;\r\n\t}\r\n\r\n\tdiv.some {\r\n\t  text-align: center;\r\n\t  background: green;\r\n\t  max-width: 40%;\r\n\t  margin: 0 auto -60px auto;\r\n\t}\r\n\r\n\t.arrow-right {\r\n\t  border-right: 5px solid red;\r\n\t  border-bottom: 5px solid red;\r\n\t  width: 25px;\r\n\t  height: 25px;\r\n\t  transform: rotate(-45deg);\r\n\t  margin-bottom: -25px;\r\n\t  margin-left: 26.5%;\r\n\t}\r\n\r\n\t.arrow-left {\r\n\t  border-left: 5px solid red;\r\n\t  border-top: 5px solid red;\r\n\t  width: 25px;\r\n\t  height: 25px;\r\n\t  transform: rotate(-45deg);\r\n\t  margin-top: 37px;\r\n\t  margin-right: 26.5%;\r\n\t  float: right;\r\n\t}
Run Code Online (Sandbox Code Playgroud)\r\n
<div class="inner">\r\n\r\n\r\n  <h1 class="title">Hello World</h1>\r\n\r\n\r\n  <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\xe2\x80\x99s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It\r\n    has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop\r\n    publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>\r\n  <br>\r\n\r\n  <div class="arrow-right"></div>\r\n  <div class="some"> SoMe\r\n\r\n  </div>\r\n  <!-- .social-icons -->\r\n  <div class="arrow-left"></div>\r\n\r\n\r\n</div>
Run Code Online (Sandbox Code Playgroud)\r\n
\r\n
\r\n

\n

Dir*_*irk 5

像这样 ?

\n\n

\r\n
\r\n
body {\r\n  background: green;\r\n}\r\n\r\nh1.title {\r\n  color: red;\r\n  text-align: center;\r\n  text-transform: uppercase;\r\n  letter-spacing: 20px;\r\n  background: green;\r\n  max-width: 70%;\r\n  margin: -40px auto 0 auto;\r\n}\r\n\r\ndiv.inner {\r\n  border: 4px solid red;\r\n  color: #fff;\r\n  padding: 15px 50px 50px 50px;\r\n  margin-top: 100px;\r\n  box-sizing: content-box;\r\n}\r\n\r\ndiv.some {\r\n  text-align: center;\r\n  background: green;\r\n  max-width: 40%;\r\n  margin: 0 auto -60px auto;\r\n  position: relative;\r\n}\r\n\r\ndiv.some::before {\r\n  content: \'\';\r\n  position: absolute;\r\n  left: 0;\r\n  top: 50%;\r\n  display: block;\r\n  border-right: 5px solid red;\r\n  border-bottom: 5px solid red;\r\n  width: 25px;\r\n  height: 25px;\r\n  transform: translate(-50%, -50%) rotate(-45deg);\r\n}\r\n\r\ndiv.some::after {\r\n  content: \'\';\r\n  position: absolute;\r\n  right: 0;\r\n  top: 50%;\r\n  display: block;\r\n  border-left: 5px solid red;\r\n  border-top: 5px solid red;\r\n  width: 25px;\r\n  height: 25px;\r\n  float: right;\r\n  transform: translate(50%, -50%) rotate(-45deg);\r\n}
Run Code Online (Sandbox Code Playgroud)\r\n
<div class="inner">\r\n\r\n\r\n  <h1 class="title">Hello World</h1>\r\n\r\n\r\n  <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\xe2\x80\x99s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It\r\n    has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop\r\n    publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>\r\n  <br>\r\n\r\n\r\n  <div class="some"> SoMe\r\n\r\n  </div>\r\n\r\n\r\n</div>
Run Code Online (Sandbox Code Playgroud)\r\n
\r\n
\r\n

\n