Wikia

Community Central

CSS for pre element

94,034pages on
this wiki

Forum page

This Forum has been archived

Visit the new Forums
Forums: Index Support Requests CSS for pre element
Wikia's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Note: This topic has been unedited for 808 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.


Hello,

I added the following css in my wiki:

pre {
border: 1px solid #94e21c;
background: #dae2b6;
color: #4b0082;
font-family: Andalus;
font-size: 5px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-buttom: 5px;
border-radius: 5px;
}

It worked pretty well, however the background color and border color were not changed. If you detect the problem, please let me know.
Penguin-Pal (talk) 18:59, August 12, 2012 (UTC)

Your CSS is valid, but it's possible it was overridden by rules somewhere else - can you link to your wiki? Also, unrelated to that, you can condense your padding values into a single rule: padding:5px 10px;.  Monchoman45  Talk  Contribs  Skystone  19:03,8/12/2012 


Thanks for the padding tip. My wiki is here.
Penguin-Pal (talk) 19:19, August 12, 2012 (UTC)
Either use "!important" or define the stylings for ".WikiaArticle pre".--PedroM (talk) 19:53, August 12, 2012 (UTC)
!important should be avoided whenever possible. Using the selector .WikiaArticle pre is the better solution.  Monchoman45  Talk  Contribs  Skystone  19:55,8/12/2012 
Thanks! it now works.
Penguin-Pal (talk) 19:58, August 12, 2012 (UTC)
Why is that?--PedroM (talk) 20:23, August 12, 2012 (UTC)
!important causes a rule to completely ignore specificity. That's "bad" because it breaks the "cascading" part of "Cascading Style Sheets", interrupts the flow of the stylesheet, and makes the stylesheet harder to maintain in the future. This article gives a good explanation. 20px_Rin_Tohsaka_Avatar.png Mathmagician ƒ(♫) 21:11 UTC, Mon, 13 August 2012
Thanks for the link.--PedroM (talk) 21:24, August 13, 2012 (UTC)

Around Wikia's network

Random Wiki