[Mediawiki-l] Changing format of Search results

Roger Chrisman roger at rogerchrisman.com
Wed Jul 11 00:52:56 UTC 2007


Eric K wrote:
> The search results are in small font (<small>). I'd like to increase
> the font size (and maybe change the red color) a bit. Looks like the
> use of the "<small>" tag for the search formatting has been hard
> coded in SpecialSearch.php. Is there a way to effect the formatting
> without modifying internal files, for example using
> Mediawiki:Common.css?

1) You could make the red match text green by adding this line to 
Mediawiki:Common.css

.searchmatch {color:green !important}

(I don't know why !important is required but it didn't work for me 
without it.)

I cooked that up by examining the page source of a search results page 
for my MediaWiki site in my browser and noting each search result match 
is within a <span class="searchmatch"> ... </span> tag.


2) To change the size of <small> for only the search results page, note 
the search results page's body tag has four class labels and the last 
one, page-Special_Search, is probably exclusively for search results 
pages:

<body  class="mediawiki ns--1 ltr page-Special_Search">

You can probably set <small> on search results pages only to whatever 
you like with a line like this in Mediawiki:Common.css

.page-Special_Search small {font-style:italic; font-size:larger}

(That style's <small> tags within class="page-Special_Search" to be 
whatever you type within the { ... }. I only added font-style:italic to 
show you can do more than just size here. I don't actually recommend 
italic for that text.)


I keep this bookmarked:
http://www.w3.org/TR/CSS21/propidx.html


I prefer to not tinker with the defaults, myself. Life gets complicated 
fast. I focus on essential stuff like keeping a back up of my wiki's 
database instead.

Good luck,

Roger :-)



More information about the MediaWiki-l mailing list