Fandom

StumbleUpon Wiki

StumbleUpon CSS Guide

227pages on
this wiki
Add New Page
Talk0 Share
This article, StumbleUpon CSS Guide, is incomplete. If you have knowledge on the subject, please help to expand it.


The HTML_Help page provides a guide to the range of HTML that StumbleUpon allows and demonstrates how HTML tags can be used to customise your page. StumbleUpon also allows the use of Cascading Style Sheet (CSS) rules to format pages.

CSS was designed to allow everything that HTML formatting allows - and to extend the formatting options available.

Browser SupportEdit

Before continuing it should be understood that StumbleUpon is available on a number of different browsers. Each browser supports CSS to slightly different degrees and it should be noted that your page may look different to SU members who use a different browser to your own. When using CSS it is wise to check your design in more than one browser - I would recommend previewing your designs in both Internet Explorer and Mozilla Firefox to ensure that your design works as expected in both.

The CSS Style AttributeEdit

The only method of embedding CSS declarations in StumbleUpon pages at the current time is through the use of the HTML 'style' attribute.

The HTML 'style' attribute can be used in any of the HTML tags that StumbleUpon allows - for example to add the style attribute to a HTML 'bold' tag you would write:


<b style="">Some Text</b>


or to an image:


<img src="your_file" alt="An Image" style="" />


However - the above 'style' attributes do not contain any CSS declarations - so will have no noticable effect.


CSS DeclarationsEdit

Each CSS declaration is made up of two parts - the property and the value - separated by a colon and ending in a semicolon - so the example of the 'bold' tag given earlier could be made useful by expanding it to the following:


<b style="color : red ;">Some Text</b>


which would produce the result:


Some Text


The HTML 'style' attribute can contain one or more CSS declarations - each separated by a semicolon to apply any number of alterations - for example:


<b style="color : red ; font-size : 9pt ;">Some Text</b>


produces the result (or something very similar to):


Some Text

FontEdit

SizeEdit

Font size can be changed by using the font-size property:


style="font-size:10pt;"


Font sizes can be specified in pt (points) or px (pixels).


ColorEdit

Font color can be changed by using the color property:


style="color:#ff0000;"


Font colors can be specified using color names, hexadecimal values (as in the above example) or the equivalent RGB values - like so:


style="color:rgb(255,0,0);"


FaceEdit

A specific font face can be specified using the font-family property:


style="font-family:arial;"


For font names using more than word the font name must be enclosed in quotes - like so


style="font-family:"Times New Roman";"


Since not all fonts are available to all users it is recommended that if you specify a specific font you accompany it with a generic font family (like serif or sans-serif) - for example:


style="font-family:"Times New Roman", serif;"


style="color:#ff0000;"


Font colors can be specified using color names, hexadecimal values (as in the above example) or the equivalent RGB values - like so:


style="color:rgb(255,0,0);"


WeightEdit

Text can be made bold using the font-weight property - for example:


style="font-weight:bold;"


There are a number of different values that can be used with the font-weight property which alter the level of boldness applied to the text:

  • normal - The text is rendered normally.
  • bold - The text is made bold. This is equivalent to using the <b> HTML tag.
  • bolder - The text is made bolder relative to the normal text for that element.
  • lighter - The text is made lighter relative to the normal text for that element.


StyleEdit

The style of text can be changed using the font-style property - for example:


style="font-style:italic;"


There are a number of different values that can be used with the font-style property:

  • normal - The text is rendered normally.
  • italic - The text is italicised.
  • oblique - The text is rendered as an oblique font.


Text DecorationEdit

Decorative elements like underlining and strikethrough text can be acheived using the text-decoration property - for example:


style="text-decoration:underline;"


There are a number of different values that can be used with the text-decoration property:

  • none - The text is rendered normally.
  • underline - The text is underlined.
  • overline - The text is rendered with a line above it.
  • line-through - The text is crossed through with a line.
  • blink - The text blinks periodically.

AlignmentEdit

Horizontal AlignmentEdit

Both text and images can be aligned horizontally using the text-align property - for example:


style="text-align:center;"


There are a number of different values that can be used with the text-align property:

  • left - The text is aligned to the left hand side.
  • center - The text is centered.
  • right - The text is aligned to the right hand side.
  • justify - The text is aligned along both the left and the right hand side.

Vertical AlignmentEdit

CSS can also be used to vertically align text and images using the vertical-align property - for example:


style="vertical-align:middle;"


There are a number of different values that can be used with the vertical-align property:

  • top - The text is aligned to the top of the surrounding HTML element.
  • middle - The text is aligned to the middle of the surrounding HTML element.
  • bottom - The text is aligned to the bottom of the surrounding HTML element.

Overriding HTML Tags With CSSEdit

CSS can even be used to override the normal formatting of HTML tags - for example:


<b style="font-weight:normal;">This Text is NOT bold even inside a B tag</b>


or


<center style="text-align:right;">This Text is RIGHT aligned even inside a CENTER tag</center>


Advanced CSS for StumbleUponEdit

BordersEdit

Any HTML element can be given a border using the CSS border property - for example:


<b style="border: solid 2px #ff0000;">This Text Has A Red Border</b>


The above style attribute would render a solid, 2 pixel wide, red border around the text.

The border property is known as a compound property. Compound properties are used as a 'shorthand' to allow many properties to be set at the same time - in this case it's the border style, width and color. One could also use the individual border properties for each side of the element, as in the following example, but the shorthand technique saves time:


<b style="border-top: solid 2px #ff0000;

border-left: solid 2px #ff0000;
border-bottom: solid 2px #ff0000;
border-right: solid 2px #ff0000;">This Text Has A Red Border</b>


BackgroundsEdit

Any HTML element can be given a background using one of two CSS properties - depending on the type of background required.

Coloured BackgroundsEdit

Coloured backgrounds can be created using the CSS background-color property - for example:


<center style="background-color: #ff0000;">This Text Has A Red Background</center>


Image BackgroundsEdit

Background images can be created using the CSS background-image property - for example:


<center style="background-image: url('http://domain.com/file.jpg') ;">This Text Has An Image Background</center>


Caution should be used when using images as backgrounds. Any background images used must be made as small as possible (the smaller they are the less time they take time to download). For this reason CSS also provides the background-repeat property to allow images to be 'tiled' either horizontally, vertically or both - so that the original image size can be kept low. The above example could be rewritten in the following manner to take advantage of image tiling:


<center style="background-image: url('http://domain.com/file.jpg'); background-repeat: repeat-both;">This Text Has A Tiled Image Background</center>


The background-repeat property can take one of three values:

  • repeat-x - The background image is tiled horizontally.
  • repeat-y - The background image is tiled vertically.
  • repeat-both - The background image is tiled both horizontally and vertically.

Image OpacityEdit

Image opacity can be specified in both Firefox and Internet Explorer. For Firefox use the opacity:0.0; property where the number is in range from 0.0 to 1.0. For Internet Explorer use the filter:alpha(opacity=00) property. Higher numbers indicate increased opacity.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.