Skip to main content
Main Content

[OUTDATED] ★ Tetra's CSS Guide ★

[OUTDATED] ★ Tetra's CSS Guide ★
Posted 2020-09-28 19:12:23 (edited)
This guide contains some outdated information. It was written before July's HTML update, which changed how we integrate CSS into our profiles, and also generally just needs a content facelift. I have no interest in updating this thread anymore, but I have started working on a new thread for a bigger and better CSS tutorial, so stay tuned for that... if I don't lose the motivation to finish it.
tetra's css guide
a massive guide to learning and writing css
welcome

Hello, folks! I'm Tetra and I enjoy toying around with CSS on occasion. I figured I should share my knowledge here since this is a complex subject for some, and I'd love to help make CSS easy and enjoyable for anyone to learn. This guide is rather text heavy, so be prepared.

I suggest you give this guide a light skim first before doing anything, so you have a good understanding of what you're facing before you really dive in. Then read it thoroughly the next time, perhaps alongside writing your first CSS.

And of course, if you have questions, concerns, criticisms, warnings, omens, prophecies, etc please feel free to contact me! I will be happy to help others with CSS-related issues* when I have the free time. But please note that I am not an all-knowing coding wizard; I have amateurish experience with CSS at best and this is not my profession. I do my best with what I know.

*by this i mean fixes and proofreads. do not ask me to create layouts for you.

Prepare yourself with the following:
  • Make sure you have a raw text editor program, or at least a program that can create and save .css files. On Windows, this would be your default program Windows Notepad. You may also search online for third-party text editors such as Notepad++. Rich text editors such as Word will not work.
  • Make sure you are on desktop. It is far more convenient to code on desktop; you might be in for a very hard and/or finicky time if you're planning to use a mobile device to code.

Optional: Download the browser extension Stylus. Stylus allows you to write custom external CSS rules that appear over a webpage's native styling. The editor offers live changes to the page as well as error highlighting. The instant feedback provided by the extension may serve as a helpful learning aid - I know it certainly did for me when I started learning! I go in-depth into using Stylus here.

preface

Before we dive in, I wish to give some pointers with regards to the meta of CSS writing.

  • If wanting to make a new layout, first figure out your design. Generate at least a vague idea of the design you want; draw/sketch it out, write out some ideas, etc. Having a vision makes writing CSS a lot easier, because you have an intended direction in mind.
  • If you are very new to CSS, start simple. Limit yourself to simple processes like changing colors, fonts, and backgrounds. When you feel comfortable enough, then you can seek to challenge yourself with bigger processes. Going too fast too soon and writing complicated things without understanding them might end up in lots of frustration and messy code.
  • Have some common sense in design. You do not want your profile to be a visual nightmare for its visitors. Use a harmonized, minimal set of colors that aren't too bright/saturated and don't scramble all over the color wheel. Use clean, non-distracting fonts that can be easily read. Don't edit the profile's contents to be unusable, unreadable, or hidden.
  • Learning a new skill will be challenging. If this is not your first time dabbling with HTML/CSS, great! You have a neat springboard of experience to work from. But if not, know that coding will take some time and struggling to get the hang of. And that's okay. Have patience, and celebrate your little victories as you learn. The more care and effort you put into a new skill, surely the better you will be at it.
css syntax
the general anatomy of css
- - -

CSS stands for Cascading Style Sheets. What it means for a webpage to possess CSS is that the page has a special set of styling rules for the browser to read and follow, in cascading order. So when writing CSS, you are stating instructions for the way a browser will display various elements on a page.

With regards to your profile page, there is already CSS written right into Wolvden's source code which gives your profile that default look. Creating a custom CSS is essentially the act of writing up a whole new .css file that overwrites some of those native default styles.

the block

A .css file is made up almost solely of blocks where the styling instructions are described. Here is the basic breakdown of a CSS block:

selector {
    property: value;
}

The selector chooses an element on the page by its name.

After the selectors is a pair of brackets. Inside the brackets are a series of property-value pairs. The block can have as many of these pairs as you like.

The property bit is a specific 'trait' you wish to change or add (e.g. the borders of a box or the color of text), and the value bit describes the change you want to make (e.g. how the borders will look or what exact color the text will be). The pair is separated by a colon and ends with a semicolon.

Here is the CSS block in action:

body {
    background-image: url('coolimage.png');
    font-family: Arial;
}

The selector is body. This targets the HTML body, which is basically the entire page.

In the first declaration the property, background-image is specified, and the value, url('coolimage.png') is attributed to the property. This does the job of changing the background image of the body to the image "coolimage.png". Likewise font-family is a property, and Arial is its value, making the whole page's text in a font face called "Arial".

Though the layout of a CSS block is simple, the versatility of CSS stems from the variety of selectors and properties you can use. So, what's left to understand is exactly which selectors and properties are at your disposal.

Instead of taking up space in this guide with long lists, I have written out separate documentations for both selectors and properties as reference. They are linked in the below sections.

selectors

Click here for the Wolvden Selectors documentation!

This list, though not exhaustive, has most of the custom elements created and named by Wolvden's own code. Take some time to skim over this for a general idea of the 'skeleton' of the page.

Additionally, in some cases you might want to write styling rules that work for a particular element, but only wherever that element occurs inside another particular element. You may write what is called a descendant selector, such as #sidebar a, which targets and styles all links that appear only in the page's sidebar portion.

And to cut down on duplicate code you may group selectors together, applying the same set of styling instructions to all selectors in the group. To group selectors, list out the selector names and separate each of them with a comma. An example would be #sidebar a, #main a to select all the links in both the sidebar and main sections, and give them both the same styling instructions.

Whereas a selector phrase specifying elements within elements separates those element names by a space, a multiple selection separates element names by a comma. Do be careful with this distinction! #sidebar a is very different from #sidebar, a since the former selects all links within the sidebar section, and the latter selects the sidebar section and all links on the page.

properties

Click here for the Properties documentation!

While there are loads of properties in existence across the entire CSS language, only a few essential properties need to be known for the niche purpose of custom Wolvden CSS. This list explains those properties as well as value examples.

In addition to this, I should talk a little about the !important modifier. Some of Wolvden's elements are a little "stubborn", meaning some of their traits are prioritized by the native CSS and therefore trying to change them in external CSS will not work. This is where !important comes in; this modifier acts as sort of a "force-fix" for a styling instruction. What this does is make the particular instruction more "important" than any other style trying to override it.

So if you write a style declaration that isn't quite working - provided this isn't due to a coding mistake - you may use the !important modifier to fix it, like so:

.breadcrumb-nav {
    background: white !important;
}

This example is relevant since the page's breadcrumb bar has some stubborn properties that can be fixed with !important. As some other elements are also stubborn, you may have to use it occasionally throughout your code, but not excessively.


*barks at you*
#202

Posted 2020-09-28 19:12:44 (edited)
stylus minitutorial
teach yourself to code even faster
- - -

Stylus is a browser extension available for Chrome, Firefox, and Opera. In Stylus you basically create personal styles for a given site URL. Since you're writing external CSS meant to overwrite default CSS, you can use the features in Stylus to your advantage.

Once Stylus is installed on your browser you should navigate to the Stylus button on your toolbar and click it. This panel will pop out. Navigate to your profile page, open this panel and click on the "this URL" portion of the Wolvden URL to "create" a new style, which will open an editor in a new window. If you can, split the screen equally so that you can see both your editor and your Den page.

The window should have these controls. The textbox on the right can be expanded by dragging down the bottom bar. You'll notice a whole lot of other controls; don't touch them, they're more or less the default settings that make your editor operational. For now, concern yourself with the textbox and the Save button.

Write to your heart's content! The editor conveniently auto-generates brackets for you and highlights critical errors such as misspellings - extremely helpful for cutting down on revision time.

As you write, hit Save at least once. This allows for your Den to start instantly reflecting your CSS changes as you type, hence why it's best to have both your editor and your profile page visible. Now you can test out code appropriately and see how your writing affects the page in live preview!

Stylus "saves" the styles you write as data within your browser. As much as you can use this as a "replacement" Notepad, I actually highly suggest against it in case something happens to your browser data. Who knows how often I've tried to clean up my computer's browser programs and end up losing precious layouts in the process. When you're done using Stylus to write, it is best to put all of your writing in a text file and save it somewhere safe to your computer. Then when you wish to edit the styles again, simply copy/paste from your text file back into the editor!

I've used Stylus to teach myself CSS as well as make and test out layouts, without having to go through the upload cycle over and over again with each change. Again, I encourage using the instant feedback provided by the editor to sharpen your coding skills and reduce frustration.


*barks at you*
#202

Posted 2020-09-28 19:12:50 (edited)
basic styling
personalizing your profile
the template

It's time to get writing! For the benefit of this guide, I have written up a minimal custom CSS template for anyone to work with. It contains empty blocks with only come of the selector names and proper CSS formatting included, so trying to apply it to your page now will result in no changes. You will have to add the changes yourself!

The template is free for both personal and commercial use. Because much of the effort and result of coding comes from your own hard work, you may use this template in your paid codes.

Click here for the template!

This link should lead you to a Pastebin page containing the text of the template. Scroll to the "RAW Paste Data" section and select everything in the textbox. Paste everything into a brand new plain text file, and start writing!

You might have noticed some statements interspersed throughout the code, each surrounded by /* and */. CSS coding allows for a neat trick called commenting where anything that goes in between those characters is treated as "invisible" and ignored by the code. While you edit the template you may delete these comment sections if you like; just make sure not to leave a spare /* or */ as that may damage your code.

Examine this snippet from the template:

body /* The HTML body of the page. */ {
    /* CODE HERE */
}

The code will not attempt to do anything with the sentences "The HTML body of the page" or "CODE HERE" since they are surrounded with the correct commenting notation. Comments are very useful for leaving "notes to self" throughout code; in the template I mainly used them to describe which selector selects what. You can write anything in commentary, even a poem if you feel like it, and as such they are very versatile for your notational needs. I encourage beginners to take the time to write notes in their code, whether to signify some areas you're struggling with, or just to neatly section off the code into something even more readable.

the background

To apply a full-sized background image to your profile, this is the appropriate code:

body {
    background: url('coolimage.png');
    background-size: cover !important;
}

This assumes you have the URL of the image you want at hand. Make sure that:
  • The URL actually works; copy and paste the URL into your browser search bar and hit enter. If the resulting page is blank or an error, the link you possess may be faulty.
  • The URL ends with .jpg, .png, or .gif, which are proper file formats for displayable images.

Looking for an image? Sites like Pixabay and Unsplash are best for finding high-quality free-to-use photos. To use them, however, you will need to download the image to your computer, and upload that image somewhere such as Imgur to obtain their appropriate image URLs.

colors, transparency, and gradients

You will mainly use the properties background and color to change the colors and transparency of various elements of the page. background affects the overall color of the element, while color affects the color of the text inside that element.

As you might have guessed, color is important to a design, and so it bears mentioning the three ways you can indicate a color in CSS: by hex code, by RGB code, and by name.

  • A hex code is a collection of six characters after a hashtag, ex: #000000 for black and #FFFFFF for white. Each hexadecimal combination yields a unique color.
  • An RGB code indicates color by calculating the amount of red, green, and blue in that color, as well as the color's transparency, ranging from 0 (transparent) to 1 (opaque), ex: rgb(0, 0, 0, 1) for opaque black and rgb(255, 255, 255, 1) for opaque white. While RGB looks more complicated, it has the advantage of creating semitransparent colors, ex: rgb(0, 0, 0, 0.5) for half-transparent black.
  • Some colors can just be mentioned by name. For pure white or black, the terms white and black work just fine. These happen to be HTML color names. Other than for white and black, though, it's suggested you stick to codes for the most accuracy; they provide a far wider variety of colors to use - millions, really - whereas there are only 140 possible names.
  • There is one other color, transparent. This is exclusive to the background property and erases the background of an element, leaving its inner content alone.

(You should never have to calculate the hex or RGB code of a color yourself as there are plenty of online tools for that - even searching up "color picker" on Google shows you an in-page color picker you can use right away.)

An example of color changing using background:

#sidebar .card {
    background: #66ffff;
}

This changes the color of the "cards" in the sidebar to light blue.

An example of color changing using color:

a {
    color: #66ffff;
}

This changes the page's link colors to light blue.

An example of transparency using background:

tr:nth-of-type(odd) {
    background: transparent !important;
}

On the default profile page, the alternating table rows of your Pack information have opaque gray backgrounds. To erase their backgrounds, this code sets the background to transparent, so that the alternating table rows blend in with the table's background instead, if the table has one.

Gradients are exclusive to the background property. A gradient is a blend between two colors on opposite ends. I would be mindful and careful about using gradients since they can seem quite garish if used excessively, but regardless, here is an example of using gradient:

#sidebar .card {
    background: linear-gradient(white, black);
}

This changes the color of the "cards" in the sidebar to a top-down gradient from white to black. Again, be mindful in color choices regarding gradients - this example isn't the most 'tasteful' to be honest, a gradient would work best with colors that are almost similar but not quite, to give an appropriate fading or shadowing effect. Much more information about gradients can be found here.

Looking for color inspiration? A useful site for colors would be the HTML Color Codes website (thanks to Bad Wolf for suggesting!), an all-in-one source for CSS color resources. The page hosts a color picker as well as color charts and information about color theory and palettes.

fonts

The font-family property dictates the font of the text inside an element. To apply one font to your entire page, this is the appropriate code:

body {
    font-family: Arial;
}

There are two types of fonts to use in CSS, each with very different usage instructions: web-safe fonts and custom fonts.

Web-safe fonts are generic font families that many computers can render on their own. You may simply use the name of the font as a valid value. Examples include Arial, Courier New, Times New Roman, Georgia, and Verdana. You might want to look at the CSS Font Stack Collection, a collection of all known web-safe fonts, with previews and statistics on what computers can render which font.

By listing more than one font, you can create a font stack. The browser will accept the topmost font that it can render, so if one of your fonts are known to fail on certain computers, you may have a fallback so your page doesn't end up in the default Times New Roman. Simply list more than one font name in the font-family property, separated by commas like so:

body {
    font-family: Gill Sans, Calibri, Arial;
}

The browser will first try to render Gill Sans.  If it cannot, then the browser falls back onto Calibri.  And if Calibri also fails, Arial is used as the final choice.

Custom fonts are different; if you want to be a little fancier, you may embed a font from an online font source. Here I will explain how to do this using Google Web Fonts, a real go-to for free online fonts.

Visit the Google Fonts website and peruse the font selection for something you like. The search toolbar enables you to specify the look of the font you like; I would suggest sticking to Serif or Sans Serif fonts as the other three are very "fancy" and not conveniently readable.

When you find a font you like, click on its card and you will be led to a page listing out the various styles of the font. Click on the "+ Select This Style" link at the far right of the style you prefer.

A panel will fly out from the right. Click the "Embed" tab, and the "@import" subheader. The text between the style tags (beginning with the @ symbol and ending with the semicolon, please do not copy the style tags themselves) is what you will need to copy. Paste this at the very beginning of your code, above all other styles. From then on you may include the name of your custom font, surrounded by single quotations, within your CSS like so:

body {
    font-family: 'Jost';
}

Again, use common sense in choosing a font. Don't greet viewers of your den with obnoxious or flowery fonts; keep it simple and clean, and most importantly, readable.

cursors

To apply a custom cursor to your profile, this is the appropriate code:

* {
    cursor: url("image-here.gif"), default!important;
}

The cursor property, of course, changes your cursor to the image provided by the URL. This assumes you have the URL of the image you want at hand. As mentioned in the earlier background section, make sure the URL for the image is functional, otherwise your cursor may not show up at all.

Looking for cursors? Sites like cursors-4u and Zingerbug host free-to-use cursors and have options for CSS integration. The easiest way to obtain these cursor URLs is to right-click on a particular cursor image and select "Copy Image Address".


*barks at you*
#202

Posted 2020-10-03 15:19:32 (edited)
finishing
bringing your design to life
- - -

With these lists and tidbits as well as a template, you should now have a decent toolbox to draw from as you write! It's now just a matter of filling in the blanks of a CSS block. This guide explains fundamental changes such as colors and fonts, but beyond that it is up to you and your own research on properties to apply more precise changes to your profile.

For the purposes of this next section, let's fast forward a bit. You have written something that is literally perfect in every way and you cannot wait to link it to your profile and have others see! ...that is, if you can figure out how to get it on there. In this section I will explain three processes: creating the .css file, uploading it, and linking it to your page for view.

creating the file

Assuming you have your CSS written out on a Notepad file, you will want to export that into a .css file - not a plain text file, as those will not be read by the browser. On Windows Notepad this should be simple. And for other programs, they will likely follow a variant of these steps.

Have your file open. Go to File > Save As...

Click the dropdown beside "Save as type:" and be sure to select "All Files".

Give your file a snazzy name, and be sure to add the extension .css after it, so that your computer knows to treat this as a .css file and save it as such.

You should now be in possession of a true CSS file! It is now ready for upload.

uploading the file

Your next goal is to acquire an appropriate link URL to that file. In order to do that, the file must be uploaded or hosted somewhere in order for it to be accessed. Because there are many places to upload files, there are just as many ways to accomplish this. However, here I will go over two specific methods: uploading to Dropbox, and uploading to Discord.

Dropbox (a more concise guide can be seen here)
  1. Sign up for a Dropbox Basic account. It's free and starts you off with 2GB of space, more than enough to store all the CSS you need.
  2. Upload your .css file into your Dropbox. With your browser parked on your Dropbox Files page, just drag your .css file into the window and wait for the upload to finish. Note that with each change you make to the .css, you will have to manually reupload the file each time.
  3. View your .css in the browser Dropbox and get its share link. Hovering over the file in-browser makes a "share" button show up; click on it and see the "share a link instead" section at the bottom of the pop-up. Click "create link" and copy the link.
  4. Modify the Dropbox share link. (this is important!) Paste the link somewhere temporary, like another Notepad file, and just replace the www bit with dl. This enables the .css file to be grabbed correctly. Copy this new link - this is your proper .css link!

Your Dropbox link might resemble this format:

https://dl.dropbox.com/s/###############/YOUR%20CSS.css?dl=0

Discord
  1. Sign up for a Discord account, if you haven't already.
  2. Create a private server. On the browser or app interface, on the left side of the screen there is a narrow section that contains servers you're in. A plus button in a circle should appear - click on it to make a new server. Customize and adjust this server as you like.
  3. Upload your .css file into the private server. With your browser parked on one of the server's channels, just drag your .css file into the window and wait for the upload to finish. Note that with each change you make to the .css, you will have to manually reupload the file each time.
  4. Copy the link of your uploaded file. Your upload should show up as a server message. Within the message, the name of this file should appear as a link. Right-click on that link and select "Copy link" - this is your proper .css link!

Your Discord link might resemble this format:

https://cdn.discordapp.com/attachments/################/################/YOUR_CSS.css

linking the file

Visit your profile page. Scroll to the bottom to find the big fancy text box under Options.

The very first button on the fancy textbox's toolbar should be the Code View switch. Click on it, and the background should turn black - this switch enables you to view the raw HTML of whatever stuff you have already put on your profile.

Below is a snippet of code that you will type into this Code View area. (This is in image format as trying to type it in here will render the HTML of this guide very weirdly!)

The underlined URL HERE text should be replaced with your .css file's public link; please be careful not to mess with the quotation marks as this may break your code.

Then, exit Code View by hitting the Code View switch again. If all goes well, you will see your page change instantly! And remember to click the green Save Changes button below the textbox.

troubleshooting

It happens, your code breaks a portion of the page or just straight up doesn't work. First of all, do not get discouraged! Because of the strictness of coding language, running into errors is an affliction no coder is immune to.

Remember that there are many possible reasons why a portion of code may not work. The issue could range anywhere from something critical (messed-up syntax) to something minute (a simple typo). The first thing you may want to do is proofread your own code. In doing so, consider these pointers:

  • Does every block have a single opening and closing bracket? Leaving out the proper brackets can severely damage your code, as the browser thinks other bits of the code are part of the block when you really do not intend for them to be so.
  • Does every comment, if any, have the proper opening /* and closing */ notation? Likewise with brackets, leaving a comment open can 'comment out' the rest of your code, which will be rendered unreadable.
  • Does every property have a single colon right after its name?
  • Does every property-value pair end with a single semicolon?
  • Have you spelled every selector, property, and value phrase correctly? The browser will produce unexpected results if it fails to recognize a certain phrase due to a simple misspelling - there is no way for the browser to guess what you were meaning to say!
  • Did you miss a comma anywhere you addressed multiple selector phrases? I suffer from this one a lot! Pay special attention to areas where multiple selector phrases are addressed and use your commas wisely.

You may peruse an online CSS linter that can highlight some syntax and typing errors. This particular linter highlights both errors and 'warnings' - you need only pay attention to the red codebreaking errors, as the warnings are mostly just etiquette correction and should be ignored.

If the issue is that your CSS is just not showing up, this might not even be a problem within your coding; go back and check that you did the Finishing steps correctly and carefully. Remember that all that needs to be in your editor is this code snippet with the URL HERE bit replaced with the .css file's proper public link.

further reading
offsite tools and resources
- - -

Congrats, you've reached the end of the guide! This end section is more or less just a collection of resources I've amassed that might help you on your CSS journey. This list will be updated as more resources are found or suggested. If you think you have an excellent resource in mind, please do not hesitate to share. (Yes, some of these links are already mentioned in the main guide - this is just to round them all up in a neat place!)

Graphics resources:
  • Unsplash / High-res royalty-free stock photos.
  • Pixabay / Same as Unsplash but with loads of patterns and vector graphics as well.
  • Subtlepatterns / Seamless light and modern patterns and textures.
  • Dinpattern / Seamless high-quality artistic patterns.
  • cursors4u / Free cursors! What more can I say.
  • Zingerbug / More free cursors!
Design resources:
  • HTML Color Codes / An all-in-one page for color picking, color charts, palettes, tutorials, and learning color harmony.
  • Coolors / Highly versatile palette generator and editor.
  • Canva Palette Generator / Pop in an image and you get a simple four-color palette from it! Great for matching a color scheme with a background image.
  • CSS Font Stack / A handy collection of web-safe fonts with OS popularity statistics.
  • Google Fonts / A massive source of custom web fonts.
Coding resources and tutorials:
  • W3Schools CSS / The reigning champion of self-learning CSS. Basically everything there is to know about CSS (and other coding languages) is on the W3Schools website, with reference lists and live tutorials. Because it's got literally everything, here are a few handy links relevant to the purposes of this guide:
  • CSS Syntax
  • Colors
  • Backgrounds
  • Borders
  • Boxshadows
  • Gradients
  • Fonts
  • Text Styling
  • Rounded Corners
  • Mozilla's Common Properties Reference - A handy list of all common CSS properties, if you wish to expand your research beyond the few I've listed. If you want to scare yourself a little, check out the full reference!
  • Stylus - Browser extension that lets you add your own private CSS rules for the pages you visit. This is massively useful for testing and learning CSS with instant feedback; I explain the finer points of Stylus in a minitutorial.
  • CSS Lint - A free online CSS proofreader that highlights critical errors and other warnings.
happy writing!
now go forth and create

*barks at you*
#202

Posted 2020-10-03 15:21:48

SCREAM THANK YOU


daffy ღ
#1713

Posted 2020-10-03 15:28:23

thank you so much for this! <3


meowsie
#1813

Posted 2020-10-03 15:31:22

You're a legend.


Rat
#4093

Posted 2020-10-05 10:53:08

this has saved me <3333333


morplebee
#2224

Posted 2020-10-05 18:48:14

this is gonna be so helpful! thank you so much <3

Kel 🧡
#3222

Posted 2020-10-06 03:42:11

Thank you so much for this!!


archius
#3244

Search Topic