Help:Wiki University Wikitext--Inline Styling

From FamilySearch Wiki
Jump to navigation Jump to search

Lessons


Intermediate


Advanced


Flexbox


Additional Helps

Inline styling[edit | edit source]

Inline style.jpg
  • By itself, the only ability that Wikitext has is to place black text on a white background as you see on this page.
  • To give any character to the text or any object on a page requires additional coding.
  • The coding we will use is called "Cascading Style Sheets" or "CSS". Those of you who have any experience in website creation will be familiar with CSS.
  • To apply CSS to Wikitext, we use "inline style" coding in the following format:
<p style="attribute">YOUR TEXT</p>

Attributes[edit | edit source]

Attributes.jpg
  • The combination of property - value is referred to as an attribute.
  • Let's use more familiar terms to perhaps make the concept of attributes with their properties and values more clear.
  • To describe a person we might state their physical attributes in the property:value form:

eyecolor:blue or hair:none or height:six feet If any of these three attributes were put in a <human> tag[1], the coding would look like this:

  • <human style="eyecolor:blue">
  • <human style="hair:none">
  • <human style="height:six feet">

Html7.jpg

We will be referring to the combination of property and value as attributes from now on.

  • NOTICE: If a property has more than one word the words are separated by a dash. For example font size should be font-size.
  • We will be introducing more attributes throughout these lessons.
  • You can find a list of attributes from W3schools.com
  • Quick NOTE; there are no limits to the number of attributes you can add.

Example of Inline styling[edit | edit source]

  • Here is an example for changing the size of the font using our paragraph tags.
<p style="font-size:20px">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>

  • Lets look closely at the inline style code and break it down into pieces. It is not as intimidating as it might appear at first glance.
  1. The opening paragraph tag <p
  2. Space after the <p.
  3. Next the word style.
  4. Followed by an equal sign =.
  5. Then a quotation mark ".
  6. The item to be changed or property: in this case font-size.
  7. A colon : .
  8. The change we want to make to the property or what value we want to give to the property. In this case we want to increase the size of the font to 20 pixels.
  9. Add another quotation mark " followed by an angle bracket >.
  • This coding will increase the size of the font from the default 14 pixels to 20 pixels.
  • NOTE: to change the size of the font, you need to place this CSS coding within the opening <p> tag as shown in the example above.

Icon-warning.png
Be sure all these symbols and parts of the coding are present. Your code will not execute even if one itty bitty, little symbol is missing. There is no forgiveness in this life or the next for a computer! They do not read minds and only process what you enter. Leaving out a colon, a quotation mark, etc will cause the browser to give you who knows what.


Try these out[edit | edit source]

Tests.gif
Exercises
  • Copy the Lorem ipsum sentence on the right into your sandbox, then change the size of the font to 20 pixels: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • Copy the Lorem ipsum sentence on the right into your sandbox, then change the size of the font to 48 pixels: Lorem ipsum dolor sit amet, consectetur adipiscing elit.


Quick Quiz
  • How many attributes can you put in the paragraph tag?
A. No more than 5
B. No more than 8
C. No more than 20
D. None of the above
  • What symbol do you use to separate a property from a value?
A. Colon
B. Semi-colon
C. Comma
D. All of the above
  1. Just in case you are wondering there is no tag labeled "human"