CSS

From IT Wiki
Jump to: navigation, search

This page is for CSS (Cascading Style Sheets) information.

Center table contents class

/* Add class "centercells" to table to center cell content */
table.centercells tr td {
   text-align: center;
}

Background color table columns

/* Shade background of odd numbered table columns */
table.fanratablecolcolors td:nth-child(odd) { 
        background-color: #EFF4F5;
}
table.fanratablecolcolors th:nth-child(odd) { 
        background-color: #EFF4F5;
}

No borders on table cells

/* Add class "noborder" to table for no borders */
.noborder td {
   border: 0;
}

WordPress

Add playlist to widget

Add to functions.php file:

/* Add support for playlist in widgets */
add_filter( 'widget_text', array( $wp_embed, 'run_shortcode' ), 8 );
add_filter( 'widget_text', array( $wp_embed, 'autoembed'), 8 );
add_filter( 'widget_text', 'do_shortcode');

Use hidden headings for navigation

Add to style.css file:

/* Add class "hidden" to h2 to hide content */
h2.hidden  {
    visibility:hidden;
    height: 0px;
    margin: 0px !important;
    padding: 0px !important;
}

Use with Table of Contents Plus plugin

Sometimes the heading is too long when you are using the Table of Contents Plus plugin. In that case, you can hide the actual heading and have the ToC use the hidden one. Here is an example:

[toc exclude="Titan, Superheavy, and Gargantuan Bases | Resin and 3D Printed Bases"]

<h3 class="hidden">Resin / 3D Bases</h3>
<h3>Resin and 3D Printed Bases</h3>

Some exclusions have difficultly working with dashes and other text. In that case, you can use an asterisk:

[toc label="Contents" heading_levels="2,3" exclude="*Tips To Potential Clients"]

Create side box

This will create a box on the side:

<div style="border: 1px solid grey; padding: 5px; float: right; width: 30%; text-align: center; font-size: .9em; margin: 5px;">
<strong>Warning About Magnets</strong><br />
Rare Earth magnets are very powerful and could be dangerous if not handled with proper care.<br />
If swallowed, any type of magnet can cause serious injury or death.<br />
Keep away from children and pets.<br />
See <a href="/about-us/legal/#Warning_About_Magnets">here</a> for a list of warnings.</div>
Warning About Magnets
Rare Earth magnets are very powerful and could be dangerous if not handled with proper care.
If swallowed, any type of magnet can cause serious injury or death.
Keep away from children and pets.
See <a href="/about-us/legal/#Warning_About_Magnets">here</a> for a list of warnings.