Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deactivate line feed with css of tag p [closed]

Tags:

html

css

Hello I'm defining a css style and I have a problem with the tag p. I am defining a style p tag and I get a line feed but I would like to deactivate its Line feed instead. How to do that?

like image 453
Francesc Clopes Avatar asked Aug 30 '11 15:08

Francesc Clopes


People also ask

Does P tag break line?

The p tag in HTML represents a paragraph. It is a block-level element which means that the text which is present inside the paragraph tag is considered as a block and it takes up the full width available. By default, the browser applies a line break before and after the p tag to separate the paragraphs.

How do you stop a line break in CSS?

The white-space property has numerous options, all of which define how to treat white space inside a given element. Here, you have set white-space to nowrap , which will prevent all line breaks.

How do you prevent a line break with an H1 H2 h3 tag?

You may want to format header tags like H1 and H2 as inline and prevent a break straight after them. Removing padding and margin does not remove the new line. By default, header tags take up all the horizontal space where they appear.

How do you break a line in CSS?

A line-break can be added in HTML, using only CSS, by employing the pseudo-class ::after or ::before . In the stylesheet, we use these pseudo-classes, with the HTML class or id, before or after the place where we want to insert a line-break. In myClass::after : Set the content property to "\a" (the new-line character).


2 Answers

I assume you are wanting to prevent multiple <p> tags from adding a line-break. In this event, try p {display:inline}; to modify the display property.

The preceeding CSS will remove the line-break by default. Depending on your criteria, you can modify it to reference a specific element or class.

like image 64
Robert Avatar answered Oct 09 '22 01:10

Robert


Do you mean the margin underneath? If so try...

p {
    margin-bottom:0;
}
like image 32
punkrockbuddyholly Avatar answered Oct 09 '22 01:10

punkrockbuddyholly