Jump to content

Help:CSS at Wikiversity

From Wikiversity

No manual

[edit | edit source]
Currently there is no manual for CSS (style sheets) for the pages of Wikiversity. Therefore, I am trying to rough out a list of what is possible. Once this is done, it will need a complete rewrite to get it into a useable form for instructors.Robert Elliott
More info on CSS can be found at http://www.w3schools.com/css/css_units.asp and http://www.w3schools.com/css/css_reference.asp




CSS at Wikiversity

<p style = "font-size: 36pt;font-family: georgia; text-align: center; color: MidnightBlue">CSS at Wikiversity</p>




CSS coding in simple HTML paragraphs

The paragraph

[edit | edit source]

A new paragraph is created with two carriage returns, not one.

Break also creates a paragraph.


Other paragraph formatting can be done with the ":" and ";" symbols at the beginning of a line (even without two carriage returns.)

Another option is to use HTML paragraphs with CSS coding.

<p>This text does not have any style applied to it.</p>

This text does not have any style applied to it.




The limitation of this format is it creates only a single paragraph and ignores multiple carriage returns in a row.

<p style = "font-size: 20pt">This text has the font-size style applied to it, making it 20pt.</p>

creates

This text has the font-size style applied to it, making it 20pt.


The only way to get multiple paragraphs is by using the break symbol

<p style = "font-size: 20pt">This text has the font-size style applied to it, making it 20pt. <br><br> This looks like a single paragraph when I write it but separate in the final output.
</p>

This text has the font-size style applied to it, making it 20pt.

This looks like a single paragraph when I write it but separate in the final output.

Therefore, you have to be careful how you use this.

CSS coding that I find useful

Simple paragraphs

[edit | edit source]
<p style = "font-size:16pt; background-color: Gold; margin-left: 1cm">Big colorful heads
</p>

Big colorful heads


Codes for paragraphs

Style Sheet formatting

[edit | edit source]

style="width:200px"

This text which has been typed to look like two paragraphs. This paragraph has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

I used the break funtion to create the second paragraph which also has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

style="width: 60%"

This text which has been typed to look like two paragraphs. This paragraph has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

I used the break funtion to create the second paragraph which also has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

style="background-color: Red"

This text which has been typed to look like two paragraphs. This paragraph has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

I used the break funtion to create the second paragraph which also has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

style="margin-left: 2cm"

This text which has been typed to look like two paragraphs. This paragraph has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

I used the break funtion to create the second paragraph which also has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

style="background-color: Red"

This text which has been typed to look like two paragraphs. This paragraph has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

I used the break funtion to create the second paragraph which also has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

style="font: 8pt/16pt georgia; margin-top: 100px; text-align: justify;"

This text which has been typed to look like two paragraphs. This paragraph has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

I used the break funtion to create the second paragraph which also has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

style="position:relative; left:100px; top:15px"

This text which has been typed to look like two paragraphs. This paragraph has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

I used the break funtion to create the second paragraph which also has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.




style="font-style: italic"

This text which has been typed to look like two paragraphs. This paragraph has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

I used the break funtion to create the second paragraph which also has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

style="marging-left:4em"

This text which has been typed to look like two paragraphs. This paragraph has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

I used the break funtion to create the second paragraph which also has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

style="text-indent:8em"

This text which has been typed to look like two paragraphs. This paragraph has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

I used the break funtion to create the second paragraph which also has lots of text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text and text.

  • style="margin-left: auto; margin-right: auto"
  • style="color: white;"




       font-family - Sets the typeface.
       font-size - Sets the font size.
       font-weight - Sets the thickness the text will be, values like bold and normal.
       font-style - Sets the style of the text, common values are normal and italic.
       font-variant - Modifies the text, e.g. small-caps.
       line-height - Sets the spacing between the baselines of adjacent lines of text.





Coding

<p style = "font-size: 14pt;font-family: georgia; text-align: center">Coding</p>

Simple Table

[edit | edit source]

Here is a simple table created with pipes

{{center top}}
{| border=1 cellspacing=0 cellpadding=5
| This
| is
|- 
| a
| '''table'''
|}
{{center bottom}}

Which looks like this

This is
a table

The coding

[edit | edit source]

These are not style sheet styles so I don't know what to call them:

  • border=1
  • cellspacing=0
  • cellpadding=5


Making improvements

[edit | edit source]

We can expand on this by adding color and a fixed width

{{center top}}
{| border=1 cellspacing=0 cellpadding=5 style="width:200px; border: DarkGreen solid 1px"
| bgcolor="#ccff99" | This
| bgcolor="#ececec" | is
|- 
| bgcolor="#99ccff" | a
| bgcolor="red" | {{center top}}{{font|color=green|'''table'''}}{{center bottom}}
|}
{{center bottom}}
This is
a
' table'


Adding width to the entire table

[edit | edit source]

The basic rule is to add CSS items which affect the entire table in the first line. In this example, I added style="width:200px" to create the width for the entire table

{| border=1 cellspacing=0 cellpadding=5 style="width:200px"

Adding color individual boxes

[edit | edit source]

The basic rule is to add CSS items which affect the entire table in the first line. In this example, I added bgcolor="#ccff99"" plus an extra pipe (vertical line) to create the color for the first box in the table

| bgcolor="#ccff99" | This
Codes for tables

Basic formatting

[edit | edit source]
  • border=1
  • cellspacing=0
  • cellpadding=5
  • bordercolor="yellow"

Style Sheet formatting

[edit | edit source]
  • style="width:200px"
  • style="width: 99%"
  • style="background-color: inherit"
  • style="margin-left: auto; margin-right: auto"
  • style="color: white;"
Codes for items in tables

Basic formatting

[edit | edit source]
  • bgcolor=Red
  • colspan="2"
  • rowspan="3"

Style Sheet formatting

[edit | edit source]
  • style="width: 200px"
  • style="background-color: #ffffa0"
  • style="border: 1px solid #777777"
  • style="border: 1px #cccccc solid;"
  • style="-moz-border-radius-topleft: 8px; -moz-border-radius-bottomleft: 8px; -moz-border-radius-topright: 8px; -moz-border-radius-bottomright: 8px"
  • style="height: 60px"
  • style="vertical-align: top"
  • style="text-align: center;"


DIV coding

I do not know what a DIV is but it works for some things Robert Elliott

Basic formatting

[edit | edit source]
<div style="margin-left: auto; margin-right: auto; width:80%">

<div style="padding:1em 5em 1em 3em;"> <!--Top, right, bottom, left -->

<div style="border-bottom:1px solid Gold; background-color:#ffffaa; padding:0.2em 0.5em 0.2em 0.5em; font-size:110%; font-weight:bold;">Title</div>



This text has the font-size style applied to it, making it 20pt.