Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jade (node.js) - more than one class on an element?

Tags:

pug

in jade one can write:

div.container 

and it compiles into:

<div class="container"></div> 

But what if you have several classes like:

<div class="span 4"><div> 

I have written it like this:

div(class="span 4") 

But I am thinking: Is there not a better way of doing it in jade?

like image 221
Piddien Avatar asked Mar 17 '12 14:03

Piddien


2 Answers

From the documentation:

how about some classes?

div.user-details 

renders <div class="user-details"></div>

multiple classes? and an id? sure:

div#foo.bar.baz 

renders <div id="foo" class="bar baz"></div>

like image 69
Matt Ball Avatar answered Oct 13 '22 05:10

Matt Ball


The following format

    div#MyBox.span12.blueButton.moveLeft 

will create

    <div id="MyBox" class="span12 blueButton moveLeft"></div> 
like image 35
gartox Avatar answered Oct 13 '22 05:10

gartox