Home > Enterprise >  How to remove line break?
How to remove line break?

Time:12-03

I'm currently working on a website and I it's putting line breaks where I don't believe it should.

For example if I'd do:

<p>a</p><p>b</p>

it'd put a line break between them. Has it always been this way?

CodePudding user response:

If you check the code search for <br/> or \n or <p></p> inside the text elements and remove the which should fix the problem.

If not provide the code snipped use browser devtools to locate the line breaks by inspecting on the browser. <p></p> is a block level element. Block level elements won't share the line with another element. You can style them and turn them into inline elements or inline-block elements.

or use <span>a</span><span>b</span>

if need anything to separate certain texts to style use <span></span>

accept the answer if it helps

CodePudding user response:

Before and after each paragraph <p> browsers add margin automatically. You can modify that using css. For example, if you want to remove the margin completely:

p {
  margin: 0
}
  •  Tags:  
  • html
  • Related