How to draw an equilateral hexagon with a border

problem description

take a look at the demo on the Internet are all nesting with div and then transform, but this does not support the emergence of borders, only borders should be how to draw?

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?


<!-- html  -->
<div class='div'></div>
<style>

.div {
    position: relative;
    width: 50px;
    height: 86.6px;
    margin: 50px auto;
    background-color: red;
}
.div:before {
    content: '';
    display: block;
    position: absolute;
    width: 0;
    height: 0;
    right:50px;
    border-width: 43.3px 25px;
    border-style: solid;
    border-color: transparent red transparent transparent;
}
.div:after {
    content: '';
    display: block;
    position: absolute;
    width: 0;
    height: 0;
    left:50px;
    border-width: 43.3px 25px;
    border-style: solid;
    border-color: transparent transparent transparent red;
    top:0;
}
</style>

this kind of Baidu is a big one. No, no, no.

< hr >

of the border you want

<div style='position:relative;width:100px;margin:0 auto;'>
  <div class='one'></div>
  <div class='two'></div>
  <div class='three'></div>
</div>
<style>
  .one {
    width: 50px;
    height: 86.6px;
    margin: 0 auto;
    border-top: 1px solid red;
    border-bottom: 1px solid red;

  }

  .two {
    position: absolute;
    width: 50px;
    height: 86.6px;
    left: 25px;
    top: 0;
    transform: translate(-50%, -50%);
    transform: rotate(60deg);
    border-top: 1px solid red;
    border-bottom: 1px solid red;
  }

  .three {
    position: absolute;
    width: 50px;
    height: 86.6px;
    left: 25px;
    top: 0;
    transform: translate(-50%, -50%);
    transform: rotate(300deg);
    border-top: 1px solid red;
    border-bottom: 1px solid red;

  }

</style>

read this blog


draw with svg.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e47797-44c56.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e47797-44c56.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?