Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Header, hr and btn at the same line [duplicate]

Tags:

html

css

I'm trying to display a header with a hr and a button at the same line. Something like this:

Header ------------------------------------ Button

See image I've tried with display flex, but the hr changed for a vertical line.

.flex-header {
  display: flex;
}
<div class="flex-header">
<h2> Des habitations pour tous </h2>
<hr/>
<button> Collections </button>
</div>
like image 901
analuspi Avatar asked Nov 24 '25 11:11

analuspi


1 Answers

You could just use a <div> with some css to create a <hr>-like line;

.flex-header {
  display: flex;
}

.line {
  display: flex;
  flex-grow: 1;
  height: 1px;
  align-self: center;
  margin: 0 20px;
  background-color: grey;
}
<div class="flex-header">
<h2> Des habitations pour tous </h2>
<div class="line"></div>
<button> Collections </button>
</div>
like image 159
0stone0 Avatar answered Nov 26 '25 02:11

0stone0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!