Difference between revisions of "Resources/Template Documentation"

Line 448: Line 448:
 
<p> You can use the button class to highlight a link in your wiki. </p>
 
<p> You can use the button class to highlight a link in your wiki. </p>
  
<div class="button"  style="background-color: #3399ff;">
+
<div class="button" >
<a href="">
+
<a href=""  style="background-color: #3399ff;">
 
REGISTER NOW!
 
REGISTER NOW!
 
</a>
 
</a>

Revision as of 15:54, 21 March 2017

MENU

Template Documentation for Teams

This page will help you edit and build your team wiki based on the default template given to your team.

The template is composed of html, css and jquery, you can find the original code here: Template: Example 2

Templates are a very useful to avoid repeating the same code or text. The way they are used in the iGEM wiki is that they host the menu and the general css styling for a group of pages. another good use is to have a banner on top of every page.

  • HTML
    • General elements
      • text
      • titles
      • links
      • images
      • unordered list
      • ordered list
      • tables
    • Layout Classes
    • Support Classes
      • Highlight
      • Styling highlight class
      • Button
      • Clear
    • Menu
      • Adding a submenu
      • Adding a menu item
      • Adding a menu with a submenu
  • CSS
    • Classes
      • Creating a new class
      • Creating a new class under an existing one
      • Changing the color of an element
  • JQUERY

HTML

Text

To write text use the < p > tag

<p> Text </p>

Titles

You can add title using the h tag, here is how the different sizes look:

Title one

Title two

Title three

Title four

Title five
Title six

<h1>Title one </h1>
<h2>Title two </h2>
<h3>Title three </h3>
<h4>Title four </h4>
<h5>Title five </h5>
<h6>Title six </h6>

Links

When creating links use the < a > tag, links will display : Example

<a href="link url "> LINK </a>

Images

You can add images to your website by using the img tag, remember all your images must be hosted on the iGEM server.

<img src="image URL ">

Unordered Lists

Use the following example to create a simple list.
Painting materials:

  • Brushes
  • Acrylic paint
  • Watercolors

<b>Painting Materials</b>
<ul>
<li> Brushes </li>
<li> Acrylic paint </li>
<li> Watercolors </li>
</ul>

Numbered Lists

To create an ordered list, use:
Things to buy:

  1. Milk
  2. Eggs
  3. Flour

<b>Things to buy: </b>
<ol>
<li> Milk </li>
<li> Eggs </li>
<li> Flour </li>
</ol>

Nested Lists

Here is an example of a nested list.

  • Cold Colors
  • Warm Colors
    1. Red
    2. Orange
    3. Yellow

<ul>
<li> Cold Colors </li>
<li> Warm Colors
<ol>
<li> Red </li>
<li> Orange </li>
<li> Yellow </li>
</ol>
</li>
</ul>

Tables

Tables created within in a page already have styling and will display:

Header 1 Header 2
Content A 1 Content B 1
Content A 2 Content B 2

<table>
<tr>
<th> Header 1 </th> <th> Header 2 </th>
</tr>
<tr>
<td> Content A 1 </td> <td> Content B 1 </td>
</tr>
<tr>
<td> Content A 2 </td> <td> Content B 2 </td>
</tr>
</table>

Layout classes

Columns

Layout classes will help structure your page. You will need to call it when you start your page to have the proper layout and make it responsive. There are two types of layout options having two columns or just one. For one column call the class column full_size and for two columns call column half_size. Here is an example to the right.

<div class="column half_size" >
<p> Content goes here </p>
</div>

Support Classes

Highlight

Highlight will need to be declared inside another layout box, this highlight class will make the background gray and the size will be slightly smaller.

<div class="column half_size" >
<div class="highlight">

</div>
</div>

Styling highlight class

There are ways to style the highlight class, you can add:

  • class="highlight gray" to add a gray background
  • class="highlight blue_top" to add a blue decorative line on top
  • class="highlight blue_border" to add a blue border around the div

These classes can be combined to create different effects, as seen in the next examples.

<div class="column half_size" >
<div class="highlight gray blue_top">

</div>
</div>

<div class="column half_size" >
<div class="highlight gray blue_border">

</div>
</div>

Button

You can use the button class to highlight a link in your wiki.

<div class="button"> <a href="URL"> REGISTER NOW! </a> </div>

Clear

This class clears the content, it is basically the same as clicking "enter" when you are writing a text.
If you add the "extra_space" class, it will add extra vertical spacing between your divs.


<div class="clear extra_space"> </div>

Adding items to your Menu

Adding a submenu item

To add another submenu page to your menu, just copy the following code and place it inside the desired submenu wrapper. In order to activate the highlight current page function, you will have to define the id, specify it like name of the page and "_page". The code to the right has an example using a page called "Test".

<a href="https://2017.igem.org/Team:Example2/Test">
<div class="submenu_button" id="Test_page">
Test
</div>
</a>

Adding a menu item

Highlight will need to be declared inside another layout box, this highlight class will make the background gray and the size will be slightly smaller.

<a href="url ">
<div class="menu_button direct_to_page">
TITLE
</div>
</a>

Adding a menu item with submenu

Highlight will need to be declared inside another layout box, this highlight class will make the background gray and the size will be slightly smaller.

<div class="menu_button">
<div class="expand_collapse_icon"> </div> TITLE
</div>

<div class="submenu_wrapper">
<a href="submenu url ">
<div class="submenu_button" id="Title_page">
Title
</div>
</a>
</div>

CSS

CSS will provide styling for your HTML elements, the code in the template is organized the following way:

  • size
    • width
    • height
  • layout
    • position
    • margin
    • padding
    • float
    • display
  • color
    • border
    • background-color
  • font
    • text-align
    • font-weight
    • text decoration
    • color
  • other
    • list-style-type
    • cursor
    • -transition

Take a look at the code and see how each element is defined, if you want change a color for a particular thing, you can modify the hex code for that color or modify the size or anything you need!

Creating a new class

In this example we are going to create a new class, it is best practice to name your classes with specific names so other code won't override them. The following code shows how to make a class that changes the background color and color of text inside a div.

/* create a div with a yellow background*/
.igem_2017_content_wrapper .yellow_message {
background-color: #fdeb39;
color: #333333;
}

<div class="column half_size yellow_message" >

This now has a yellow background

</div>

Creating a new class under an existing one

In this example we are going to create a new class under the highlight class this means that to use it properly, you will need to declare and add it after mentioning the "highlight" class

/* highlight with a full yellow border decoration */
.igem_2017_content_wrapper .highlight.yellow_border {
border: 4px solid #fdeb39;
}

<div class="column half_size" >
<div class="highlight yellow_border" >

</div>
</div>

Change the color of an element

This is very simple and easy thing to do. First, you will need to find which element or class you want to modify and then replace the hex code for the color. In the following example we

/* styling for the titles h1 h2 */ .igem_2017_content_wrapper h1, .igem_2017_content_wrapper h2 {
padding:5px 15px;
border-bottom: 0px;
color: #fdeb39;
}

<h1> This is now yellow </h1>
<h2> This is now yellow </h2>

This is now yellow

This is now yellow

JQUERY

Jquery makes the menu and other interactive elements in the website work, for example the open and closing of the submenus along with the icon that reflects the state of said submenu.