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

Time:02-20

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

CodePudding user response:

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

  • Related