You are here: FS > TWiki Web > PatternSkinCssCookbookTopBarBackgroundImage r1 - 14 Oct 2005 - 23:41 - TWikiContributor


Start of topic | Skip to actions

PatternSkinCssCookbook Recipe: Put a wide background image in the top bar

This recipe shows how to put a background image while keeping the logo (and possible other elements in the top bar).

The style below sets an image as background of #patternTopBar. The image is higher than the top bar, but because the left bar and main contents have their background set to white the rest of the image is not shown.

Add the dynamic variable link to the big image:

<style type="text/css" media="all">
#patternTopBar { background-image:url("%ATTACHURLPATH%/universe.jpg"); background-position:0 500px; }
</style>

The background-position shifts the image in the div 'viewport' - in this case we shift the image 500px up to show an interesting part.

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:
<style type="text/css" media="all">
#patternTopBar { background-image:url("https://fs.rainysky.org/pub/TWiki/PatternSkinCssCookbookTopBarBackgroundImage/universe.jpg"); background-position:0 500px; }
</style>
You can always write a <style> in a topic - all current browsers support this - but the page won't validate as valid XHTML.

toggleopenShow attachmentstogglecloseHide attachments
Topic attachments
I Attachment Action Size Datedown Who Comment
topbarimage.csscss topbarimage.css manage 0.3 K 14 Oct 2005 - 20:55 ArthurClemens? css to frame the page centered on the screen
Edit | Attach | Printable | Raw view | Backlinks: Web, All webs | History: r1 | More topic actions
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding FS? Send feedback