Paragraph with br Tag

Br tag is used to add single line break.We can directly add <br> in pug template or add br on new line in paragraph.Br tag is followed by the pipe|” ,followed by the text content.

Syntax:

p  paragraph content
br
| text content

Example 2: Below is an example of paragraph with <br> tag.

HTML
doctype html
html(lang=&quot;en&quot;)
    head
        meta(charset=&quot;UTF-8&quot;)
        meta(name=&quot;viewport&quot;, content=&quot;width=device-width, initial-scale=1.0&quot;)
        title Paragraph 
        style.
          body {
            margin:1.5rem;
            font-family:  Times, serif; 
          }  
          h1,h3,i {
            margin: 1rem ;
            text-align: center;
            color:green;
            }
    body 
        h1 Welcome to w3wiki
        h3 Paragraph with br and italic tag
        p Pug is a template engine for node.js and browsers to render dynamic reusable content.  While writting the pug template one should consider the indentation.
        br 
        |   At compile time the template engine compiles our pug template code to HTML .
        i Pug  has many powerful features like  conditions,loop,include and mixins using which we can render HTML code based on user input or reference data.
Javascript
//app.js

const express = require(&quot;express&quot;);
const app = express();
const port = 3000;
app.set(&quot;view engine&quot;, &quot;pug&quot;);
app.get(&quot;/&quot;, (req, res) =&gt; {
  res.render(&quot;paragraph&quot;);
});
app.listen(port, () =&gt; {
  console.log(`server is running at http://localhost:${port}`);
});

Output:

Paragraph in Pugjs



Paragraphs in Pug View Engine

Pug is a template engine for NodeJS and browsers, enabling dynamic content rendering. It compiles templates to HTML, supports JavaScript expressions for formatting, and facilitates the reuse of static pages with dynamic data. Its indentation-based syntax simplifies tag specification, enhancing readability.

Table of Content

  • Paragraphs in Pug:
  • Approach to Creating a Pug Paragraph:
  • Paragraph with br tag:

Similar Reads

What are Paragraphs in Pug?

The p tag defines a paragraph. A paragraph is a block-level element so a new paragraph always begins on a new line, and browsers naturally put some space before and after a paragraph to make it look neat and easy to read. If users add multiple spaces, the browser reduces them to a single space....

Approach to Create a Paragraph in Pug

Express Setup: Initializes an ExpressJS server.Setting View Engine: Configures Pug as the view engine for rendering templates.Routing: Defines a single route for the root URL (/). When accessed, it renders the paragraph Pug template.Pug Template: The Pug template defines the structure and content of the HTML page. It includes a paragraph with headingsStyling: Internal CSS is used within the Pug template (style.) to set margins and styles for headings and the paragraph....

Steps to Create a Pug Application

Step 1: Create a NodeJS Application using the following command:...

Paragraph with br Tag

Br tag is used to add single line break.We can directly add
in pug template or add br on new line in paragraph.Br tag is followed by the pipe “|” ,followed by the text content....