Wiki Requirements/Using HTML, CSS, and Javascript
On this page
HTML versus MediaWiki markup
All the iGEM web sites are built on top of MediaWiki, which allows groups of people to create and edit pages easily.
MediaWiki has its own markup for formatting pages, creating links, etc. However, using HTML allows more creativity and flexibility. iGEM's websites allow any HTML tags. Simply enclose your HTML inside <html>
tags within the page text.
You can mix wiki markup and HTML on the same page. Just make sure all the HTML is inside <html>
tags, and all the wiki markup is outside <html>
tags.
Example:
== A page including both wiki markup and HTML == This page uses ''wiki markup'' for part of the text, and ''HTML'' for another part. <html> <p>Here is an HTML paragraph with <i>italic text</i> in it.</p> </html> And there's more '''wiki markup''' at the bottom of the page!
Note: Using HTML in MediaWiki pages will cause the final page (as fully rendered by MediaWiki) to be noncompliant with strict HTML formatting specifications. This is basically inevitable, and is an acceptable trade-off for the added flexibility in wiki design that you get by using HTML. Most modern web browsers will interpret pages in "quirks" mode, which tries to "do the right thing" with HTML that is not strictly compliant.
How to make "inline" CSS and Javascript
You can include CSS or Javascript within <style>
or <script>
tags in your HTML. It is customary to put CSS styling at the beginning of your page (before the main content), and Javascript code at the beginning or the end.
Example:
<html> <style type="text/css"> h2 { color: red; } /* ... more CSS here ... */ </style> <script type="text/javascript"> var foo = 3; // ... more Javascript here ... </script> <!-- Main content of the page starts here --> <h2>This text will be red</h2> <p>This text will be the normal text color</p> <!-- Main content of the page ends here --> <script type="text/javascript"> var a = 1; var b = "apple"; /// ... more Javascript here ... </script>
How to use templates include CSS and Javascript
If you want to use the same styles or scripts on several different pages, it is useful to write them in one place and then "include" them on your individual pages. One way you can do this is to use MediaWiki's Template function.
Create a page whose name starts with "Template:YourTeamName". Inside <html>
tags, put the material you want to include:
<html> <style type="text/css"> h2 { color: red; } </style> </html>
Then, use MediaWiki's syntax to include the template on another page:
2015.igem.org/Team:YourTeamName/ProjectHow to use <link> and <script> tags to include CSS and Javascript
To use this method, create a page whose name starts with "Template:YourTeamName" and enter your CSS or Javascript code without any surrounding <html>
tags:
div.classname { border: 1px solid green; } #id { color: red; }
Why are we required to host all content on *.igem.org?
1. Because content tends to disappear if it is hosted elsewhere
It seems very easy to create a stylesheet or host an image on your personal server or your university server, and then link to it from your wiki. That link will work for a while. But two years later, the link is likely to be broken. This is what happens to externally hosted content after time has passed.
If some future iGEM team wants to learn about your project and use the wonderful parts you created, they will want to read your wiki. And if your wiki is full of broken links, missing images, and broken styling, they will have a lot of difficulty understanding what your project was about!
2. Because someone might think you cheated the wiki freeze
The vast majority of teams have honest intentions when they use externally hosted content, and they do not change anything after the wiki freeze. But you could edit your externally hosted content after the wiki freeze, and it doesn't have MediaWiki's editing history, so someone could easily think you did edit after the wiki freeze.
Editing content after the wiki freeze is considered a form of cheating, and cases would be handled by the Responsible Conduct Committee.