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

is it possible to make inner child in the same row as his father in css?

According to this html structure:

 <h1>title</h1>
 <div>
   <label>label</label>
   <span>span</span>
 </div>

Is it possible to make title with label in one row and the span in the second row (full width) and without change the html layout? is support by flex or grid? like so:

title label
span

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 :

You could use this CSS:

h1 {
  display: inline;
  font-size: unset;
  font-weight: unset;
}

h1 ~ div {
  display: inline;
}

h1 ~ div > span {
  display: block;
}

See it work on this fiddle

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