* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-size: 15px;
font-family: 'Times New Roman', Times, serif;
}
.container {
margin: 50px auto 0;
border: 2px black solid;
width: 90%;
height: auto;
display: flex;
}
.header {
text-align: center;
justify-content: center;
margin: auto;
font-size: 15px;
}
.heading {
justify-content: flex-start;
flex-direction: column;
}
<div class="container">
<div class="logo">
<img src="css/logo.png" height="125px" width="125px" id="logo_img" alt="">
</div>
<div class="header">
<h3>DEPARTMENT OF FORENSIC MEDICINE <br> POST GRADUATE INSTITUTE OF MEDICAL EDUCATION AND <br> RESEARCH,CHANDIGARH</h3>
</div>
<hr>
<div class="heading">
<h3>Forensic Toxicology Laboratory</h3>
</div>
</div>
My print layout has the logo and the multi line heading as the header. There is a heading that will be placed below that. I’m unable to put the heading below the header.
I would also like to add a horizontal line above and below the heading:
I’m hoping to create this:
2
Answers
This is one approach you could follow, with explanatory comments in the code:
References:
block-size
.display
.flex-basis
.flex-direction
.flex-flow
.flex-wrap
.gap
.column-gap
.row-gap
.inline-size
.margin-block
.margin-inline
.You have to create a container for the row (logo + header) with
flex-direction: row;
and change the.container
layout toflex-direction: column;
.The result I get:
My result
Another solution is to use the CSS Grid layout to set
.container
to be a 2 by 2 grid and then place logo, header and heading withgrid-row
andgrid-column
.