Problems with Divs

Inserts <p> with text

The wikidot software automatically wraps all text in a div in the paragraph tag <p>. Therefore, this wiki code

[[div]]
Some text.
[[/div]]

becomes

<div>
<p>Some text</p>
</div>

in the final HTML source.

This may not seem like such a big deal at first, but suppose you wanted to put the text right up at the top of the div, say for a navigation element in a page :

Some text.

As you can see, it causes a space at the top and bottom. This is the result of the <p> tag.

One Possible Solution

One possible solution is to use [[span]] rather than a [[div]] and set the display to block

[[span style="display:block;border:1px solid #000;"]]Some text.[[/span]]

This will result in :

Some text.


Bookmark and Share

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License