Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two lines in h1 tag

Tags:

html

css

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?

like image 305
Oded Harth Avatar asked Jul 27 '11 14:07

Oded Harth


People also ask

How do you break H1 into two lines?

You can insert markup inside h1 , so that you can simply do <h1>foo<br>bar</h1> .

How do you make two lines in HTML?

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!

What is a H1 tag example?

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.


2 Answers

Using:

<h1>Line 1 <br/> Line 2</h1> 
like image 120
Tom Walters Avatar answered Oct 14 '22 17:10

Tom Walters


A W3C validated method is

<h1>Line 1 <span style = "display: block;">Line 2</span></h1> 
like image 42
JWorks Studios Avatar answered Oct 14 '22 16:10

JWorks Studios