Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to: Jade HTML content after child element

Tags:

pug

I have an h1 with a content of "World" and with a span with content "Hello" as its immediate child. How do I put the h1's content ("World") after the span's content ("Hello")?

Here's the code (Jade HTML):

h1
  span Hello
  World

Output: Hello

like image 431
John Smith Avatar asked Oct 19 '25 03:10

John Smith


1 Answers

Jade provides three common ways of getting plain text. You can read the documentation here.

So by piping at the start of the text, it behaves as normal text and not a HTML tag.

h1
span Hello
| World

You can also add it inline.It will be in a single line which makes the jade code more readable.

h1 #[span Hello] World

Or add a custom class to span

h1 #[span.custom-classname Hello] World
like image 110
AmitJS94 Avatar answered Oct 22 '25 06:10

AmitJS94



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!