data/TWiki/PatternSkinCssCookbookCenterPageBorder.txt
author Colas Nahaboo <colas@nahaboo.net>
Sat, 26 Jan 2008 15:50:53 +0100
changeset 0 414e01d06fd5
permissions -rw-r--r--
RELEASE 4.2.0 freetown
     1 %META:TOPICINFO{author="TWikiContributor" date="1141771402" format="1.1" version="3"}%
     2 
     3 ---+!! PatternSkinCssCookbook Recipe: Center the page with a border
     4 
     5 *This recipe shows how to put a border around the page, while centering the page horizontally.* The example on this page uses a gradient image as background - on top of a gray base color. You can choose to set no image of course.
     6 
     7 <div class="twikiHelp">
     8 This line loads the extra style definition:
     9 <verbatim>
    10    * Set USERSTYLEURL = %ATTACHURL%/centerpageborder.css
    11 </verbatim>
    12 You can write this line in %SYSTEMWEB%.TWikiPreferences, in WebPreferences, in your user topic or on a single page.
    13 </div>
    14 
    15 Add the dynamic variable link to the logo image to the topic text:
    16 <verbatim>
    17 <style type="text/css" media="all">
    18 #patternScreen {
    19 background-image:url("%ATTACHURLPATH%/gradient_page.gif");
    20 background-repeat:repeat-x;
    21 }
    22 #patternPageShadow {
    23 background-image:url("%PUBURLPATH%/%SYSTEMWEB%/PatternSkin/striped_pageshadow.gif");
    24 }
    25 </style>
    26 </verbatim>
    27 <div class="twikiHelp">
    28 %ICON{info}% If you don't write this overloading style in a template and use an external =.css= file, you need to set the image to the absolute url:
    29 <pre>
    30 &lt;style type="text/css" media="all">
    31 #patternScreen {
    32 background-image:url("%<nop>ATTACHURLPATH%/gradient_page.gif");
    33 background-repeat:repeat-x;
    34 }
    35 &lt;/style>
    36 </pre>
    37 You can always write a =&lt;style>= in a topic - all current browsers support this - but the page won't validate as valid XHTML.
    38 </div>
    39 
    40 <style type="text/css" media="all">
    41 #patternScreen {
    42 background-image:url("%ATTACHURLPATH%/gradient_page.gif");
    43 background-repeat:repeat-x;
    44 }
    45 #patternPageShadow {
    46 background-image:url("%PUBURLPATH%/%SYSTEMWEB%/PatternSkin/striped_pageshadow.gif");
    47 }</style>
    48 
    49 %META:FILEATTACHMENT{name="centerpageborder.css" attr="" autoattached="1" comment="css to frame the page centered on the screen" date="1129323328" path="centerpage.css" size="259" user="TWikiContributor" version=""}%
    50 %META:FILEATTACHMENT{name="gradient_page.gif" attachment="gradient_page.gif" attr="" comment="background image" date="1141771401" path="gradient_page.gif" size="3854" stream="gradient_page.gif" user="TWikiContributor" version="1"}%