Override Inline Styles With CSS

Posted by Ed Johnson on 16 Feb 2010 05:38, last edited by RobElliott on 16 Feb 2011 10:04

: css gallery image module styles

rating: +3

There are times when it would be nice to be able to override some of the inline styles that are hard-coded into parts of a Wikidot page. There is a technique that makes this possible. The trick is to use this syntax:

selector1selector2selectorx[style]{property: value !important;
}

My specific application for this was that I wanted to remove some of the elements that are displayed when using the Lightbox Viewer with the [[gallery]] module. Using Firebug to inspect the lightbox images, I found the selectors and properties that I wanted to override. Using this technique, I was able to hide the image numbering (Image x of y), the Close button and the Prev and Next buttons.

You can use this code in a css module on any page where you have a [[gallery]]:

[[modulecss]]
/*hidethe "Imagexofy" display*/
#lightbox-image-details-currentNumber[style]{display:none !important;
}
/*hidetheentirebottomdatabox (includingtheclosebutton) */
#lightbox-container-image-data-box[style]{display:none !important;
}
/*leavethe "prev" overlaygraphicastransparent*/
#lightbox-nav-btnPrev[style]{background-image: url(/common--theme/base/images/lightbox/lightbox-blank.gif) !important ;
}
/*leavethe "next" overlaygraphicastransparent*/
#lightbox-nav-btnNext[style]{background-image: url(/common--theme/base/images/lightbox/lightbox-blank.gif) !important ;
}[[/module]]

You can edit this to your preferences. I also bundled this code for use as a set of four CSIs.

If you find other uses for this technique with other Wikidot elements, please share them!

In Action

Author

Ed Johnson Ed Johnson . Please visit his/her userPage.


Related articles

Comments

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 によって変換されたページ (->オリジナル) /