This is a documentation subpage for Template:Border. It contains usage information, categories and other content that is not part of the original template page. |
This template uses Lua: |
This template uses TemplateStyles: |
This template uses block elements, e.g. See H:DIVSPAN for details. |
Usage
editThis specialized template creates a box to display text or combined text/images in; it creates a border around whatever you would like. Each property has a default so you do not need to define the setting if what you want is already the default.
You can embed other templates within this one (e.g. {{rule}} or {{sc}} or even another {{border}}). However, embedded templates that contain parameters, and things like tables, may cause this template to not work properly. In that case, use {{border/s}} and {{border/e}} instead.
Note: If you place images inside this box, be sure to define it so that the box is larger than the image.
Example: Default
{{border|Your content here}}
Example: All parameters
{{border|position=|compact=|class=|attr=|max-width=|bstyle=|bthickness=|color=|bgcolor=|align=|padding=|style=| Your content here }}
Parameters
edit- 1: whatever goes in the box
- position: alignment of the box
- Options: left, center, right; default: center
- compact: whether the box should take only the width needed (if true) or use the full page width (if false)
- Options: true, false; default: false
- class: additional CSS classes
- attr: additional attributes for the box
- Example:
attr=id{{=}}"border-id"
- Example: in another template based on this one,
attr={{optional style|...}}
- Example:
- Style parameters:
- maxwidth: maximum width of the content area in pixels or percentage (default: null/full width)
- Note 1: You probably don't want 100% as it doesn't mean 100% of that "section" of the page. It means 100% of the screen size. So, if you choose 100%, it will end up going off the screen as the screen size will be added to the size of the navigation bar on the left. If you want it to just fill the content area of the screen, leave the option empty.
- Note 2: Maximum width is used so that the box is responsive to screen sizes smaller that won't allow the box to fit without scrolling right. ie. mobile browsers
- Note 3: If your box contains text, do not use px as a unit, as this will scale badly if text is a different size (mobile, export, and visually-impaired users with large system fonts). Use a text-relative size like em instead. See H:PXWIDTH for details.
- bstyle: border style (default: solid)
- Options: solid, dotted, dashed, double, groove, ridge, inset, outset
- Note: If you choose a border such as double but a thickness of 1px, it will still appear to be a single border because it is only 1px thick. Therefore, for the non-solid borders it is recommended to choose a value greater than 1px.
- bthickness: border thickness in pixels (default: 1px)
- color: border color (default: #000000, black)
- bgcolor: background color (default: transparent)
- Note: You can define the color in plain English (e.g. white) or hexadecimal (e.g. #FFFFFF). See Web Colors for more information.
- align: alignment within the box
- Options: left, center, right, justify
- padding: padding, the space between the border and the content inside it, in pixels (default: 5px)
- style: CSS, which will override any styles defined before it
- maxwidth: maximum width of the content area in pixels or percentage (default: null/full width)
Examples
editBasic examples
editExample: Not compact
{{border|compact=true| [[File:Philadelphia blackletter.svg|125px|link=|alt=Philadelphia:]] {{uc|{{Mc}}Carty & Davis,}} No. 171, {{uc|Market Street.}} {{rule|3em}} 1834. }}
McCarty & Davis, No. 171, Market Street.
1834.
Example: Position
{{border|position=right|compact=true| [[File:Philadelphia blackletter.svg|125px|link=|alt=Philadelphia:]] {{right|{{uc|{{Mc}}Carty & Davis,}} No. 171, {{uc|Market Street.}}}} }}
McCarty & Davis, No. 171, Market Street.
Example: Position
{{border|position=left|compact=true| [[File:Philadelphia blackletter.svg|125px|link=|alt=Philadelphia:]] {{uc|{{Mc}}Carty & Davis,}} No. 171, {{uc|Market Street.}} {{rule|3em}} 1834. }}
McCarty & Davis, No. 171, Market Street.
1834.
Example: border/s and border/e
{{border/s}} [[File:Philadelphia blackletter.svg|125px|link=|alt=Philadelphia:]] {{uc|{{Mc}}Carty & Davis,}} No. 171, {{uc|Market Street.}} {{rule|3em}} 1834. {{border/e}}
McCarty & Davis, No. 171, Market Street.
1834.
Style parameters
Example
{{border|maxwidth=25em|bstyle=dashed|bthickness=5px|color=black|align=center| [[File:Philadelphia blackletter.svg|125px|link=|alt=Philadelphia:]] {{uc|{{Mc}}Carty & Davis,}} No. 171, {{uc|Market Street.}} {{rule|3em}} 1834. }}
McCarty & Davis, No. 171, Market Street.
1834.
Example
{{lorem ipsum}} {{border|maxwidth=25em|color=black|position=right|padding=40px| [[File:Philadelphia blackletter.svg|125px|link=|alt=Philadelphia:]] {{right|{{uc|{{Mc}}Carty & Davis,}} No. 171, {{uc|Market Street.}}}} }} {{lorem ipsum}}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
McCarty & Davis, No. 171, Market Street.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Example
{{border|maxwidth=25%|bthickness=2px|color=#FF0000|bgcolor=aqua|position=left| [[File:Philadelphia blackletter.svg|125px|link=|alt=Philadelphia:]] {{uc|{{Mc}}Carty & Davis,}} No. 171, {{uc|Market Street.}} {{rule|3em}} 1834. }}
McCarty & Davis, No. 171, Market Street.
1834.
Example
{{border|maxwidth=25em|bstyle=ridge|bthickness=10px|color=navy|bgcolor=#66FF99|align=center|padding=20px|style=border-radius:25px| [[File:Philadelphia blackletter.svg|125px|link=|alt=Philadelphia:]] {{uc|{{Mc}}Carty & Davis,}} No. 171, {{uc|Market Street.}} {{rule|3em}} 1834. }}
McCarty & Davis, No. 171, Market Street.
1834.
Example
{{border/s|maxwidth=25em|bstyle=ridge|bthickness=10px|color=navy|bgcolor=transparent|align=center|padding=20px|style=border-radius:25px}} [[File:Philadelphia blackletter.svg|125px|link=|alt=Philadelphia:]] {{uc|{{Mc}}Carty & Davis,}} No. 171, {{uc|Market Street.}} {{rule|3em}} 1834. {{border/e}}
McCarty & Davis, No. 171, Market Street.
1834.
"Double Border"
Standard
There are two ways to make a double border. One is to use the standard "double border" feature of CSS. It is simple and only requires that parameter 3 be equal to double. Here is what this will look like:
Example
{{border|maxwidth=25em|bstyle=double|bthickness=8px|align=center|padding=20px| [[File:Philadelphia blackletter.svg|125px|link=|alt=Philadelphia:]] {{uc|{{Mc}}Carty & Davis,}} No. 171, {{uc|Market Street.}} {{rule|3em}} 1834. }}
McCarty & Davis, No. 171, Market Street.
1834.
Example
{{border|maxwidth=15em|bstyle=double|bthickness=20px|align=center|padding=20px| [[File:Philadelphia blackletter.svg|125px|link=|alt=Philadelphia:]] {{uc|{{Mc}}Carty & Davis,}} No. 171, {{uc|Market Street.}} {{rule|3em}} 1834. }}
McCarty & Davis, No. 171, Market Street.
1834.
Creative / Controllable
However, for more control, you may wish to use a border within another border:
Example
{{border|maxwidth=25em|bthickness=2px|position=center|padding=7px| {{border|bthickness=5px|bgcolor=#FFEFD5|align=center|padding=20px| [[File:Philadelphia blackletter.svg|125px|link=|alt=Philadelphia:]] {{uc|{{Mc}}Carty & Davis,}} No. 171, {{uc|Market Street.}} {{rule|3em}} 1834. }}}}
Displays as:
McCarty & Davis, No. 171, Market Street.
1834.
See also
edit- {{Border}}: fully-customizable box
- {{Ruled box}}: for boxes with borders only on top and bottom
- {{Centered Box}}: centered box, width to fit text
- {{Frame}}: full-width frame around content