1

I have a grid layout:

#price {
  display: grid;
  grid-template-columns: auto repeat(3, 1fr) auto;
  grid-template-rows: auto 1fr;
  grid-gap: 3vw;
}

And cant seem to find a way to make a responsive title like element like the one containing "lorem" below.

Image of layout

William Dam
  • 129
  • 2
  • 12

2 Answers2

2

For achieving such a functionality, I would suggest you to check the HTML fieldset and legend. As specified in the docs

The <fieldset> element provides a grouping for a part of an HTML form, with a nested <legend> element providing a caption for the <fieldset>.

You can then style the fieldset and legend using CSS to obtain the expected result.

Lal
  • 14,726
  • 4
  • 45
  • 70
1

html center is hacky but wasnt what i was showing....

showing that

fieldset and legend is probably the best use here.

    <fieldset>
    <legend>monster</legend>
    <center>
      <h2>Lorem ipsum</h2>
    </center>
  </fieldset>
fieldset{
    border: 1px solid #74D5EB;
    font-weight: bold;
}

legend {
    border: 1px solid #74D5EB;
    padding: 3px 6px;
    margin:auto;
    border-radius: 15px;
}
Seabizkit
  • 2,417
  • 2
  • 15
  • 32