Home > Software design >  Align elements in the same line
Align elements in the same line

Time:03-16

Is there a way to align these elements in the same line. Right now it is one below the other

<h5>Title</h5><a id="downloadData"  href="" target="_blank" download><h5>Download</h5></a>

CodePudding user response:

Try with float property

https://www.w3schools.com/cssref/pr_class_float.asp

<div>
    <h5 style="float: left;">Title</h5>
    <a style="float: left;" id="downloadData"  href="" target="_blank" download><h5>Download</h5></a>
</div>

CodePudding user response:

Only use floats if your site is stuck in the year 2000, nowadays you use flexbox for that:

.wrap {
  display: flex;
  gap: 20px;
}
<div >

  <h5>Title</h5>
  <a id="downloadData"  href="" target="_blank" download>
    <h5>Download</h5>
  </a>

</div>

  •  Tags:  
  • html
  • Related