An introduction to
HTML and CSS.
HTML and CSS are the building blocks of the web, and you'll need to have a basic understanding of both before being able to write your own journal skins.
You might find it easier to work through and absorb Creative Journal CSS if you play along as you go, testing out the things I talk about. A simple way to do this is to use CSSEdit by xork - which gives you a live preview of your journal as you code it. Otherwise you can create a new journal and keep hitting the preview button (but try not to hit the 'Add' button! ;p)
HTML
Skipping a lot of history and waffle, HTML is the language used to describe web pages and their content (eg this is a heading, this is a paragraph, this is a list etc). The way you describe things is by using things called tags - ie <p>this is a paragraph</p>. Note that the closing tag has a slash in it - all but a few specific tags need to be closed in this way, if you don't close them properly you can/will encounter problems when writing your CSS.
There are many different tags, but on deviantART we can't use all of them, so to keep things simple, the only tags you need to learn for the purpose of your journal are the following:
div
div tags are general purpose 'block level' containers. I'll go into further detail about what that means in the CSS section below, but basically it means that they act like boxes that span the width of their container.
They are usualy used to group sections (or 'divisions', which is what they're short for) of a HTML document, to make it possible/easier to create certain effects with CSS (such as creating a sidebar or special box for thumb features etc).
More complicated journal designs will use these a lot, and examples of where deviantART uses them is for your journal itself, comment boxes and in lots of other places.
ul, ol and li
Currently, if you wanted to make a list, you might be writing it as plain text:
1. List Item one
2. List Item two
3. List Item three
or
- List Item
- List Item
- List Item
There are some problems with doing things this way, and one is that when a list item becomes too wide and wraps onto the next line things can start looking quite messy and more annoying to read. Another is that if your list numbers run into double digits or more you'll lose the clean lines of the left edge of the list items.
Enter HTML list tags! :)
ul tags create what are called 'unordered' lists - essentialy this means each list item has a bullet next to it. ol creates ordered lists - numbered/lettered lists. Within those two list tags, you enclose each list item in li tags - ie:
<ul>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<ul>
<ol>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<ol>
Which would give the following:
- list item
- list item
- list item
- list item
- list item
- list item
On deviantART you can see examples of list tags in your journal's moods list, your recent watchers list, and your userpage stats (ie number of deviations and pageviews). The lists above might not look anything like your moods list, or your recent watchers list - but with a bit of CSS all that can change!
img
Image tags are one of the special tags that don't have a closing tag, instead you place the closing slash just before the end bracket -
<img src="#" alt="" width="" height="" />
Those things in the img tag are called properties - src points to the address of the image you want to have shown.
The alt property (often mistakenly called the 'alt tag') provides text that browsers should display when the image doesn't load - but if the image is purely decorative, the alt property should be 'nulled' (left empty, but not ommitted, as seen in the example above).
width and height are optional (you'll probably never use them), if omitted the browser will work it out and display the image in it's original size - and regardless, you can specify the width and height with CSS anyhow.
a (links)
Chances are you know what a link is already, but here's how you write it in HTML:
<a href="http://www.google.com" title="foo">i am a link to google.com</a>
The HTML code above creates a link to google that'd look like: i am a link to google.com. The bit inside the href property is called the URL - in simple English it's the web address of the page you want to link to.
Most of the time, links are as simple as that - but they can do more. With the link tag you can also place what is called an 'anchor':
'invisible anchor'
<a name="thumbs"></a>
'visible anchor'
<a name="thumbs">#thumbs</a>
Anchors let you (and other people) write links that point to specific parts of your journal. When someone clicks on a link to an anchor it will jump down the page to where you set the anchor. This can be handy when you want to link people to your thumb feature for instance - or if you have a really long journal, you can create a table of contents to let people jump to the various sections.
To link to an anchor on a deviantart journal the URL would look like: http://deviantuser.deviantart.com/journal/234923472/#thumbs - the hash (#) tells your browser that you're linking to an anchor with the name 'thumbs'.
When adding a link in your journal that points to an anchor in the same journal (as you'd need to in a table of contents), it's a bit tricky because you need to know the address of your journal first, but since you haven't submitted it yet, you don't know what the address is - so what you need to do is submit your journal first, then go back and add the links to the anchors later.
An example of anchors on deviantART is when you click on the comments link at the bottom of someone's journal on their userpage, and it skips straight to the comments on the next page.
b (and strong), i (and em), and u
DeviantART allows you to use b, i and u tags to make text bold, italicized and underlined.
Technically they should not be used anymore if what you want to do is show emphasis - strong and em should be used instead - so use those if you want to be smart, but you don't have to (for the record I use b and i on deviantART, but strong and em on websites I build).
If you want to be smart you'll also stop giving non link text underlines, people expect underlined text to be links.
Examples of strong used on deviantART include bold text in your journal moods list, and in your userpage stats.
sup, sub
These tags are used for denoting text that should be superscript or subscript - things like H2O, or 25o C. They shouldn't really be used simply for making text small - but on deviantart it wont matter if you use it now and then for that purpose. In general though, if you want to lower the font size of your journal, use CSS where you can, and try to restrain yourself from lowering the font size of your text too much - you'll only be making it harder for people to read.
code
code tags are used to denote text as code (ie you might be sharing some CSS). Traditionaly browsers will set a monospaced font to text wrapped in code tags - don't be tempted to change this, though you can add borders, change background colour etc. By default code is also inline (like bold or italic tags), but you can use CSS to make your code appear in blocks.
blockquote
blockquote tags are used when you want to quote someone, not to indent text! If you want to indent your text, don't be lazy, use CSS.
In HTML there is an additional tag, cite that you can use to cite your quote. DeviantART doesn't allow us to use it though, so you have to improvise by using a div with a class name of cite (or if you know you'll never use a certain tag, such as sup, inside a blockquote, what you can do instead is use sup instead of using a div tag - saving you having to write out class names - but more on that later.)
abbr
The abbr is handy when you want explain what an abbreviation or acronym means - for example LOL. People will aslo use it to hide secret messages etc, although it wasn't intended to be used in this way.
abbr tags are written like so:
<abbr title="Land of Llamas">LOL</abbr>
strike
strike tags are used when we want to cross out text - often this is used when you want to make a correction, or an update, without removing the orginal text. ie:
original: I'm freaking out man! I lost my entire collection of rare dust! It was layed out on my desk one moment, and when I came back from making a sammich it was gone!
update: I'm freaking out man! I lost my entire collection of rare dust! It was layed out on my desk one moment, and when I came back from making a sammich it was gone! nevermind, I found it.
strike tags are used just like the other inline tags:
<strike>striked out text</strike>
hr
The hr tag, like the img tag, is self closing and has no properties. You use it when you want a horizontal line to seperate content in your journal - you could use a div tag instead, but it's shorter a neater to use a hr:
<hr />
On deviantart they will be invisible unless you reveal them with CSS using display: block, but more on that in the next section.
p
You wont be using paragraph tags in your deviantART journals very often, but since they can be used I'm putting them here for completeness.
<p>This is a paragraph!</p>
The reason you wont be using them much (if at all) is, as you may have noticed, because deviantART will automaticaly turn your line breaks into br tags, hence simulating paragraph tags.
Now would be a good time to familiarise yourself with the above HTML tags - have a play around with them and see how they look in their default non-CSS state before moving onto the next section on CSS.
CSS
Skipping even more history and waffle, CSS stands for Cascading Style Sheets. Stylesheets describe how websites should look, without them you're stuck with the browser's default way of showing webpages. (If you're using Firefox, you can go to View > Page Style > No Style and disable the stylesheet for this page and you'll see how things look without CSS.)
A CSS document is known as a stylesheet, and a stylesheet is a collection of rules (comonly refered to as 'styles') which look like the following:
.journaltext blockquote{
color: #f00;
background: #ff0;
}
In plain English, the rule above tells the browser to look for all elements with the class name 'journaltext' (the period at the front means it's a class name), and then find all the blockquotes within it and colour their text red and background yellow.
Remember: the part before the first curly bracket is known as the selector - because it selects which element(s) will get the properties specified between the curly brackets. Selector and properties, got it?
A class name is a property you can give to a div or img tag so that you can write specific styles for it. For instance, you might want to give a set of thumbs a one pixel thick red border. The best way to do this would be to wrap your images in a div and give the div a classname of 'specialThumbs' ie:
<div class="specialThumbs">
:thumb######:
:thumb######:
:thumb######:
</div>
Then, you'd write the following CSS:
.specialThumbs img{
border:1px solid #f00;
}
The thumbs deviantART generates from your thumb codes are just img tags (inside some other tags, but more on that later) - so to put a red border around your thumbs you have to apply it to the img tag. Note also how img doesn't have a period in front of it - when you want to style a tag (any tag, be it bold tags, div tags, links) you just write the tag name. The period is only used to specify class names.
When writing CSS you should use class names that describe the element, so in this case we use 'specialThumbs' instead of 'redBorder' - because if you later decide to change the border style, you just change the properties in .specialThumbs img{ ... } instead of making a new class of 'orangeBorder' (or worse - leaving the class name as 'redBorder' but changing it to orange in the CSS). It's also a good idea, because later when you look back through your CSS it's easier to understand what does what.
We've covered the HTML tags you can use, and you've gotten a taste for CSS, next I'll take you step by step through making your own journal skin. As we go along I'll cover everything there is to know about CSS and your deviantART journal.