How?Div and Span Style

From OneSci
Jump to: navigation, search

With the div and span class styles, you can fine tune how text is formatted on a particular section of a page.

Lets use two examples to get started


Example 1
<span style="font-size:95%; text-align:center; color:#999;">

All words between the span tags will take on the attributes specified by the style code 
</span>
Anything outside of it will not


All words between the span tags will take on the attributes specified by the style code

Anything outside of it will not



Example 2
<div style="
border:solid #aaa 1px;
font-family:Georgia, Palatino, 
margin: 0 1em 1em 0; 
background:#FFFFFF; 
width:{{{width|33em}}}; 
padding:7px; 
padding-bottom:1px;
border-top:1px solid #CCC;
margin-top:3px;
float:{{{1|left}}};
">


If you specify a box, then whatever is between the div tags goes in the box
</div>
And once the div tag is closed, it no longer belongs to that element. Get it?

If you specify a box, then whatever is between the div tags goes in the box




And once the div tag is closed, it no longer belongs to that element. Get it?




A more advanced example
<div style="border:solid #aaa 1px; font-family:Georgia, Palatino, margin: 0 1em 1em 0; font-size:95%; 
background:#FFFFFF; width:{{{width|33em}}}; text-align:left; padding:7px; padding-bottom:1px; float:{{{1|left}}};">
<div style="font-size:100%; text-align:center;">[[File:The OneSci Axon.png|400px]]
<div style="text-align:center; border-top:1px solid #CCC; font-size:85%; color:#999; margin-top:3px;">
[{{fullurl:Template:HeadlinesMainPage|action=edit}}<span style="color:#777;">Change-up today's headlines</span>]
<tt>·</tt>[[News-Newsroom|<span style="color:#777;">THE AXON NEWSPAPER</span>]]<tt>·</tt>
[[User:Jeremy Biane|<span style="color:#777;">Share or write an article</span>]]</div></div>
{{Space|3}}
Result

 

  • <div style="property:value;">
  • float=left; - Moves object to left and allows other objects to boarder to the right


Green stellar icon

Green stellar icon

File:StarIconGreen.png

text text text





























the end

Personal tools