Removing a new line after the <h1> tags?

I had a problem deleting lines after the <h1> , since every time it prints it adds a line break right after it, so something like <h1>Hello World!</h1> <h2>Hello Again World!</h2> is displayed as follows:

 Hello World! Hello Again World! 

I'm not sure which tags I need to change in CSS, but I expect this to have something to do with padding or fields

I also want to keep the vertical padding, if at all possible.

+65
html css stylesheet header styles
Feb 20 2018-12-12T00:
source share
4 answers

It looks like you want to format them as embedded. By default, h1 and h2 are block level elements that span the entire line width. You can change them to inline css as follows:

 h1, h2 { display: inline; } 

The difference between block and inline described in more detail here: http://www.webdesignfromscratch.com/html-css/css-block-and-inline/

To maintain vertical filling, use inline-block , for example:

 h1, h2 { display: inline-block; } 
+108
Feb 20 2018-12-12T00:
source share

<h1> {display: block} tags are set. They are block elements. To disable this:

 {display: inline} 
+7
Feb 20 2018-12-12T00:
source share

I just solved this problem by setting the value of the h1 field to minus in the html style section. It works great for my needs.

 <style> h1 { display: block; font-size: 0.9em; margin-top: -1.91em; margin-bottom: -1.91em; margin-left: 0; margin-right: 0; font-weight: bold; } </style> <h1 style="text-align:center"> Headline </h1> 
+3
Jan 13 '15 at
source share

 <style> h1 { padding: 0px; margin: 0px; } </style> 
-one
Jul 06 '17 at 21:48
source share



All Articles