Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to align content on the arrow in Css?

.content>.line>div {
  --line-width: 2px;
  --x-offset: 8px;
  --x-width: 120px;

  position: relative;
  padding-bottom: var(--line-width);
}

.content>.line>div:before {
  content: "";
  display: block;
  position: absolute;
  bottom: 0;
  left: var(--x-offset);
  width: var(--x-width);
  height: 100%;
  border-right: var(--line-width) dashed currentColor;
  border-bottom: var(--line-width) dashed currentColor;
}

.content>.line>div:after {
  content: "";
  display: block;
  position: absolute;
  top: calc(-1 * var(--line-width) * 1.75);
  left: calc(var(--x-offset) / 2 + var(--x-width));
  width: 0;
  height: 0;
  border: calc(var(--line-width) * 2.5) solid transparent;
  border-top: 0;
  border-bottom: calc(var(--line-width) * 5) solid currentColor;
}
<div class="content">
  <div class="line">
    <div>content here</div>
  </div>
</div>

How to align content on the arrow in Css? I tried change position but the content i always on the top of the line.

I want to place content on the image like below. enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Add to the bottom of the div, 10px.
then it will be in the middle of the arrow.

  .content>.line>div:before {
        content: "";
        display: block;
        position: absolute;
        bottom: 10px;
        left: var(--x-offset);
        width: var(--x-width);
        height: 100%;
        border-right: var(--line-width) dashed currentColor;
        border-bottom: var(--line-width) dashed currentColor;
    }
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading