|
|||||||
![]() |
|
|
Thread Tools |
|
|
#1 | ||
|
I crashed my car into the bridge, I don't care
![]() ![]() ![]() ![]()
Super Moderator
Join Date: Oct 2009
Posts: 5,528
~(^.^)~
|
Hello again everyone!
This guide is an introduction to HTML for those who have never worked with it or even know what it is or does. HTML stands for Hypertext Markup Language. It's the programming language that converts text to webpages. You can literally do anything with HTML, but for the purposes of this guide I'm only going to explain the simplest stuff you can use here at Smogon in your analyses or guides. Everyday interaction with HTML If you've ever worked on an analysis here at Smogon you've done a little HTML! Ever wonder why we have you use those <p> tags? Those <p> tags and the other structured text we have you do is what makes the analyses look as they do on the StrategyDex (with help from scripts in the Smogon Content Management System (SCMS) ). Proper use of HTML HTML is a system of tags. Typically, anything you want to show up on your analysis properly needs to be "wrapped" in the tags. In order for tags to work they must be placed in the front of the text you want to change, and "closed" at the end. For example, in order for the <p> tags to work, your paragraph must start with <p> and then end with </p>. Note the slash in the second tag. The slash is actually very significant. It defines where the tag ends. In order for any HTML to work it must have a start and an end. There's a lot of other nuances to HTML, but I'll explain those in the specific examples below. HTML you can use in your analyses and articles Here I will list the tags you can and probably will end up using at some point if you choose to write for Smogon. <p> </p> <p> tags, or paragraph tags, defines a paragraph. Everything you put inside the <p> tags will be a part of that paragraph. Every analysis needs these tags to define the separate paragraphs, otherwise the paragraphs will be "broken" (in this instance merged or squashed together) on the StrategyDex. <strong> </strong> This tag bolds certain text in your analysis. <em> </em> This tag italicizes certain text in your analysis. <del> </del> This tag puts a <u> </u> This tag underlines text in your analysis. <a> </a> and href The <a> tags put a hyperlink in your analysis. In order to use it properly they must be used in conjunction with the href attribute. Here is an example of a hyperlink and how you'd use it in an analysis: <a href="http://www.smogon.com">Smogon</a> There's a couple important things to note when using this tag. The first thing to note is the space between the a and href. The second is the =, it defines where the link starts. The url must then be wrapped in " ", which defines it. Finally, don't forget to close the link with the </a> tag after you're finished hyperlinking the text you wish to. Because of the SCMS, most of the links you want to get to on the Smogon website can be cut to the / after the smogon.com. So for example, if you wished to link to another Pokemon's analysis, this is how you'd link it. <a href="/bw/pokemon/abomasnow">Abomasnow</a> Another thing to be wary of is that some parts of the site ends in a backslash /. For example, if you wanted to link to the RU Hub, you'd use the following: <a href="/tiers/ru/">RU Hub</a> <ul> </ul> and <ol> </ol> and <li> </li> The first two tags stand for unordered list and ordered list respectively. The <li> tags stand for list. In order to use the first two they must be used with the <li> tags. The <ul> tags have this effect when used:
You'll use this one most commonly in your analysis for damage calculations. In order to do this, here's how it should look in your analysis: Quote:
The <ol> tags have this effect when used:
or <ol type="A">
<dl> </dl>, <dt> </dt>, and <dd> </dd> You'll only really use these if you're writing an article. These tags stand for definition list, defined item, and description of item respectively. This is how you'd use them in an article: <dl> <dt>Coffee</dt> <dd>Black hot drink</dd> <dt>Milk</dt> <dd>White cold drink</dd> </dl> You can see these tags in action on the Smogon Credits page. The whole page is wrapped in a single <dl> tag, each username is wrapped in a <dt> tag, and each separate description line is wrapped in a <dd> tag. <h2> </h2> (and h3, h4, h5, h6) The <h#> tags stand for header. These tags break up an article just like how I break up this article into different headers. You can most commonly see these in action in our Smog articles. Issue 23's Featured Uber Pokemon is a good one. The important thing to note about the <h> tags is that the higher you go in number, the smaller the header gets. <h2> is typically the largest header you'll see and the most visually appealing. All subheaders will typically be <h3> and then <h4>. Finally, the last use of HTML you may want to use in your article is a table. Tables are a little complicated, but you usually won't ever have to use a very complicated one. Here are the tags you'd use and in descending order: <table> </table> Defines where the table begins and ends. Wrap this around the whole table and use only once. <thead> </thead> This is the table's header. <tr> </tr> Defines a row in a table. <th> </th> Defines a header cell. <tbody> </tbody> This is the table's body. <td> </td> Defines a body cell. That's a lot of tags to take in, and that's not it. However, Smogon makes it pretty easy. Almost every table you'll use will start off with this tag: <table class="sortable"> This tag gives you a table that looks like every one we have onsite. The other part for getting the table to look like the ones we have onsite is to alternate the background color we have available every other row. In order to do this, the following tag must be used alternatively.: <tr class="a"> This puts the blueish tint to the background of the table to divide it more clearly. When put all together, this is what your table HTML should look like when used in practice: Quote:
There is so much more to HTML than this, including working with articles as a whole and including images. However, I'll save those for another guide as they get pretty complicated. Hopefully this guide will help those who (like myself before coming to Smogon) have never even seen or worked with HTML before at least know their way around a tiny bit. Have fun out there! Last edited by Oglemi; Mar 5th, 2013 at 8:50:55 PM. |
||
|
|
|
|
|
#2 |
![]() ![]() ![]()
|
image and br tags, noting how they are self-closed due to not being wrapped around anything
example: HTML Code:
<div><img src="/download/sprites/bw/528.png" alt="" /></div> <p>Emboar @ Leftovers<br /> Trait: Blaze<br /> EVs: 252 SpA / 4 SpD / 252 Spe<br /> Timid / Modest Nature<br /> - Substitute<br /> - Fire Blast<br /> - Focus Blast<br /> - Flame Charge</p> center (used for centering text as well): HTML Code:
<div style="text-align: center;">content here</div> HTML Code:
<div style="float: right; margin-left: 10px;">content here</div> it is also worth noting that div is a block level, which means it will place the content on a new line. if for any reason you want the content to be inline, use span tags instead. speaking of which, i do not know if it's worth mentioning this, but you cannot place a block level element inside an inline element because of what i said above. for example, p and table tags can never ever be inside a href or span tags. i have seen stuff like this before (header tags being inside p tags) and it will cause a validation error. also, a mention about validating (though this would need further writing to explain it) and further resources to learn more about the basics of html would be neato. oglemi you're a loser by the way......
__________________
Last edited by ium; Jan 5th, 2013 at 10:28:52 PM. |
|
|
|
|
|
#3 |
|
rip numeros
![]()
|
it's probably worth noting the basic article html head structure as it's different from the normal:
HTML Code:
[title] Article Title [head] <meta name="description" content="short description of article" /> [page] <div class="author">By <a href="link to author's profile">Author</a> HTML Code:
<ol class="toc"> <li><a href="#short_section_name">Full Section Name</a></li> <li><a href="#short_section_name">Full Section Name</a></li> </ol> short example (from the pokemon dictionary): HTML Code:
<ol class="toc"> <li><a href="#gens">Generations</a></li> </ol> <h2><a name="gens">Generations</a></h2>
__________________
C&C Work | 1k RMT | Contribute! | VM for an OU Rate! | gp member: vm/pm for a check | previously pokemon0078 / aka jew-cane
Last edited by Jukain; Mar 5th, 2013 at 9:06:40 PM. |
|
|
|
|
|
#4 |
|
I love mafe
![]() ![]() Join Date: Oct 2010
Posts: 1,374
|
I read most of this so I think you didn't mention this, but you can preview your html by doing the following. Open notepad and paste your html. File=> Save As. Where it says file type ".txt," change it to "all files." Then enter a name and end it with .html. After that, you can open the file in your web browser and it will translate the html you do to the proper formatting.
I find this method good if you like to visualize what you do, instead of coding and proofreading that.
__________________
[21:11] <&Oglemi> opera da best [21:12] <%Birkal> I love opera [21:12] <%Birkal> our college put on cosi last year; it was great [21:12] <%Birkal> OH MY GOODNESS [21:12] <%Birkal> THIS CONVERSATION IS ABOUT WEB BROWSERS [21:12] <%Birkal> =X |
|
|
|
![]() |
| Thread Tools | |
|
|