1

I need to put this image, and also make this risk at the center of it. Is there any kind of border that make this?enter image description here

HTML:

<div id="discussoes">
    <img id ="img-topico" src="botão - criar tópico.png"/>
</div>

PedroB
  • 47
  • 7

1 Answers1

1

You can do it with a pseudo element. This solution is flexible (works with every image/line height).

jsFiddle

HTML

<div class="middle-border">
  <img/>  
</div>

CSS

img {
  width: 80px;
  height: 80px;
  background: blue;
  display: block;
  margin: 0 auto;
  z-index: 2;
  position: relative;
}

.middle-border {
    position: relative;
    background: yellow;
    text-align: center;
}

.middle-border::before {
    content: "";
    display: block;
    height: 5px;
    background: red;
    width: 100%;
    position: absolute;
    z-index: 1;
    top: 50%;
    transform: translateY(-50%);
}

Result

enter code here

Itay
  • 16,601
  • 2
  • 51
  • 72