Div

: _syntax

"Div" stands for "division".

To improve the layout you can use [[div]] ... [[/div]] elements which transform to html @div> ... </div@ blocks.
Allowed attributes are: class and style. The difference is that with style you can put CSS instructions close to the text, but this is not a good idea, instead of putting CSS instructions within your custom theme, with class.

Div style

[[div style="float:left; width: 45%; padding: 0 2%"]]
left column left column left column left column left column
[[/div]]
[[div style="float:left; width: 45%; padding: 0 2%"]]
right column right column right column right column right column
[[/div]]
~~~~

left column left column left column left column left column

right column right column right column right column right column

Div class

[[div class="two-columns"]]
left column left column left column left column left column
[[/div]]
[[div class="two-columns"]]
right column right column right column right column right column
[[/div]]
~~~~

And within the custom CSS stylesheet:
.two-columns{float:left; width:45%; padding:02%}

left column left column left column left column left column

right column right column right column right column right column

Main reference

Ask your question below

can I add a label to a div element?
Paola Manzini Paola Manzini 12 Aug 2012 07:37

for instance, suppose I create a box as a custom div element: can I add a label to it and reference it in another part of the page?
The box I am trying to add a label to is this one:
http://community.wikidot.com/howto:box-with-rounded-corners
Many thanks!
paola

by Paola Manzini Paola Manzini , 12 Aug 2012 07:37
Re: can I add a label to a div element?
RobElliott RobElliott 12 Aug 2012 11:02

What you can do is to create a CSS module on your page (or put the CSS code on your main CSS page) containing the styling for the div, then use the div as many times as yu need to on your page. For example:

[[module css]]
.aquamarine {
 background-color: aquamarine;
 border: 2px solid #888;
 border-radius: 10px;
 margin:10px;
 padding:10px;
 width: 200px;
[[/module]]
[[div class="aquamarine"]]
Some content
[[/div]]
[[div class="aquamarine"]]
Completely different content
[[/div]]

So the label is the name of the class that you have created, in this case aquamarine. Both divs that you have created will reference the same CSS. If you change the CSS it will change the way both divs look.


Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.

Last edited on 12 Aug 2012 11:04 by RobElliott
by RobElliott RobElliott , 12 Aug 2012 11:02
Re: can I add a label to a div element?
Helmut_pdorf Helmut_pdorf 13 Aug 2012 06:05

On Syntax documentatin you will find the "Anchors"
i copied the text here for better explanation:

Anchors

(done with ++ [[# anchors]]Anchors)

To place an anchor use [[# anchor-name]] syntax.
To refer to an anchor (and scroll to it) use [#anchor-name text to display].

You need only to insert an "invisible!" anchor after your div-start command/tag: a.e.:

  • [[# div-two-col]]

and can everywhere on this page insert the link to this label by building an "internal link inside your page ( like on toc) with

  • [#div-two-col MY DIv-2-col] which displays like a link only MY DIv-2-col

or you can build a link on all of your pages on all sites

  • with the eternal link [*http://YOUR_SITE.com/YOUR_PAGE#div-two-col MY DIv-2-col] which does exactly show the same link like the internal one MY DIv-2-col but links to this (invisible!) anchor on your page from all the internet.

If you want to make the anchor visible than you have to write after the anchor the label itself a second time ( like here in this post the "Anchor"..

As an example you can have a look on the howto: http://community.wikidot.com/howto:site-check-llist which is using 3 anchors ( and not "toc").


Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.

Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?

Last edited on 13 Aug 2012 06:34 by Helmut_pdorf
by Helmut_pdorf Helmut_pdorf , 13 Aug 2012 06:05
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.
Click here to edit contents of this page.
Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.
Append content without editing the whole page source.
Check out how this page has evolved in the past.
If you want to discuss contents of this page - this is the easiest way to do it.
View and manage file attachments for this page.
A few useful tools to manage this Site.
Change the name (also URL address, possibly the category) of the page.
View wiki source for this page without editing.
View/set parent page (used for creating breadcrumbs and structured layout).
Notify administrators if there is objectionable content in this page.
Something does not work as expected? Find out what you can do.
General Wikidot.com documentation and help section.
Wikidot.com Terms of Service - what you can, what you should not etc.
Wikidot.com Privacy Policy.

AltStyle によって変換されたページ (->オリジナル) /