0

how can I make "div.header-title" center itself (max-width at 750px). Each H1,H2, H3 below should be a new line aligned left.

.header-title {
    display: flex;
    justify-content: center;
    align-items: center;
}

h2 {
display:block;
text-align:left;
}
<div class="header-title">
    <h1 class="title">Title 1</h1>
    <h2 class="author">Author</h2>
    <h2 class="author-info ">more from <a href="#">Author</a></h2>
</div> 
Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
1xxooxx
  • 57
  • 1
  • 7
  • Does this answer your question? [How to specify line breaks in a multi-line flexbox layout?](https://stackoverflow.com/questions/29732575/how-to-specify-line-breaks-in-a-multi-line-flexbox-layout) – frederj Nov 27 '19 at 22:12

1 Answers1

0

Add the following in your media query:

.header-title {
    flex-wrap: wrap;
    margin: 0 auto;
    max-width: 750px; 
}

& .header-title h1,
.header-title h2 {
    width: 100%;
}
Asbjørn Ulsberg
  • 8,721
  • 3
  • 45
  • 61
pk_tan777
  • 351
  • 1
  • 3