I need to fit two lines in one h1 tag (instead of making two separated h1 tags).
How can I create a line break inside of h1 tag?
You can insert markup inside h1 , so that you can simply do <h1>foo<br>bar</h1> .
To create line breaks in HTML, use the <br> tag. There is no closing tag necessary. In the code above, there will be a line break between "125 N 6th St" and "Brooklyn, NY 11249" that won't have the outrageous amount of space that appears between two paragraph elements. It'll just be a nice line break!
The H1 tag is an HTML heading that's most commonly used to mark up a web page title. Most websites use CSS to make the H1 stand out on the page compared to lesser headings like H2, H3, etc.
Using:
<h1>Line 1 <br/> Line 2</h1>
A W3C validated method is
<h1>Line 1 <span style = "display: block;">Line 2</span></h1>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With