Posted by Feather's CSS Guide

Fea [eyup chuck] (#42722)

Notable Lion
View Forum Posts


Posted on
2016-05-02 02:41:08

~ Feather's CSS Guide~


Hey everyone. I'm Fea, nice to meet you. I hope you've clicked this because you'd like to learn some coding! I'm going to be teaching you how to use CSS to make your den look nice. I'm a web developer in real life, so this is fun for me!


What you're going to need



◼︎ Some kind of text editor (notepad, notepad++, Atom etc.)
◼︎ Some patience. Coding is difficult to learn at first, but once you get the hang of it, you'll find that it starts to come more naturally.
◼︎ Basic knowledge of HTML. HTML and CSS are best friends, you need to know how to HTML first, there are plenty of guides around Lioden for that!
◼︎ Some kind of file hosting spot such as Dropbox, Google Drive.


What is CSS?


CSS are Cascading Style Sheets . If HTML is the walls and structure of a house, CSS is the guide to what colour you're painting your walls, and what kind of doors you want. The cascading part just means that the file is read from top to bottom by the browser. If you write some CSS further down the file that affects the same thing as another rule further up, the one closest to the bottom overrides. (This is important, and one of the things you need to watch out for to avoid using !important too much).

I'd like to point out at this point that CSS does not look the same in every browser. Although we're pretty close to getting them all similar now, there are some differences. Each browser (chrome, firefox) have their own engine which reads and interprets the code that it is given by a server.



Basic rules of CSS




To get your CSS in your page, you need to use this code, without asterisks:

<*link rel="stylesheet" type="text/css" href="YOURCSS.css"*>

It has to be a ".css" file that you save it as, and can be hosted somewhere such as Dropbox, or Google drive.

Awesome, let's cover the basics! CSS has a very particular format in which it is written. Here's an example:

body {
color: #3D4F47;
background: url('http://static.lioden.com/images/nightBG.jpg');
background-attachment: fixed;
}

This code is what you'd use to change the background and text colour of the entire page. If it looks complicated, don't worry! Allow me to explain.

CSS targets a particular element on the page, which relates to the HTML name of a tag, or a class. You can see here that this CSS rule is targeting the body tag in the page's HTML. This isn't a class name, it's a default, pre-defined HTML tag.

These bad boys --> {} are called curly brackets . They tell the browser, after declaring which element you're targeting, where your new CSS rules are going to start and end.

So this:

body {}

Is technically valid CSS! You're just not telling the browser to do anything with it yet.

Here's that same code, but with the first rule in it:

body {
color: #3D4F47;
}

So, CSS isn't perfect. There are some vague things and weird quirks. 'color' is actually about the text colour. You'll notice that it's in american spelling too! That's just part of CSS. As an English developer, it's just a rule you have to remember! The part after the colon is the colour you want the text in the WHOLE page to be. You can override this further down the file if you wish, for specific elements or boxes. The colour we have here is a hexadecimal number, which represents a colour. They always start with a '#', kinda like a hashtag! You can actually use words too, but there's a limited list of ones that work, such as ' color: red; '.

Here's a place you can grab colour schemes in hex codes from: Paletton

Here's the same code again, but this time we're going to add the background image we want to use!

body {
color: #3D4F47;
background: url('http://static.lioden.com/images/nightBG.jpg');
}

There's our previous text-changing code, and then below it, a new rule which is pointing the browser to change the 'background' property of the 'body' tag. After the colon, we've then told the browser to get ready to accept a url. That's just a full web address that leads to an image. You can grab that from any image as long as it's hosted somewhere by right-clicking and "copy image address" or similar, depending on your browser.

Remember to use your brackets and single quotes to tell the browser THIS IS THE URL! Then, paste the URL in between them!

This code will change the background of your page to be anything you put into the quotes, as long as the image is valid.

Here's the code again, except this time in it's final form! (ROOAAAR!)

body {
color: #3D4F47;
background: url('http://static.lioden.com/images/nightBG.jpg');
background-attachment: fixed;
}

You'll notice there's a final rule we've added. This one is actually optional, and gives the impression, when you scroll, that the background is 'fixed' (pinned) against the back of the web page, and the content infront moves up and down it. Neat. We've specified the property background-attachment , and told the browser to make it fixed .

You can see that there's now a closing curly bracket after the final 'rule'. This tells the browser that we're done editing the rules for the body tag ; get ready for the next item.

Basically, most simple CSS rules take this form, where you specify which element you want to change, and then 'key : value' 'rules'.



Guide-by-Element



Now you know the basics of how writing CSS works, I'm going to show how to target some specific elements of the Lioden Den layout, so you can change them as you like with your own CSS file! When targeting a class you'll find that you need a '.' at the beginning of the name. This means it's a class. If you (hopefully rarely) need to target an id, you'll use a '#' hash.



Page Background (Body)



Target with: body {}

☑︎ background: (hex code | colour name)
☑︎ background-attachment: (scroll|fixed)
☑︎ background: url(' URL HERE ')
☑︎ background-repeat:



Lioden generic layout elements




◼︎ a:link, (link in it's default state)
◼︎ a:visited, (link when it's been clicked on previously)
◼︎ a:active (link as it's being pressed down)
(These can be added after any of the elements below to target their specific links)

☑︎ .topbar (the bar right at the top with welcome message in it)
☑︎ .main (the container for the entire content, edits sidebar bg without touching anything in it)
☑︎ .navbar (navigation bar background/container)
☑︎ .navbar-default .navbar-nav > li > a (targets all the links in the navbar)
☑︎ .col-md-9 (main left content)
☑︎ .breadcrumb (the breadcrumb bar inside left content that shows you where you are)
☑︎ .panel (background colour of Bookmarks/Achievements/Stats boxes)



Tables on Den (where your lion info/pride is)


☑︎ .table .top (changes the table headers)
☑︎ tr.right (changes whole ABOUT table)
☑︎ td.right (changes just the right section of the ABOUT table)
☑︎ .inner-table (targets the info blocks inside ABOUT table)
☑︎ .inner-table .right (targets left of info block ie. stats, cubs, male slots)
☑︎ .inner-table .left (targets right (values) of info block items ie. 16/200)
☑︎ .table .bottom (changes bottom bar of tables)

The above targets will create rules for every table on the den page. If you'd like to specify which table, Abbey recently added the following IDs:

☑︎ #about
☑︎ #player
☑︎ #pride
☑︎ #sparring
---> (sparring block has an extra class called .right-odd which has the sparring dropdown in it)
☑︎ #allies
☑︎ #clans

You can use these in such a way:

☑︎ #about.table
☑︎ #pride.table .top

And so on.





Hrt Icon 0 players like this post! Like?

Edited on 05/06/16 @ 07:10:28 by Feather :: Need a bigger boat (#42722)

Fea [eyup chuck] (#42722)

Notable Lion
View Forum Posts


Posted on
2016-11-28 05:00:19
Hey Fella c:

That's because 'enter' or a 'carriage return' is considered whitespace and means nothing in html. To get guaranteed spaces, use < br> (linebreak) or wrap your text in paragraph tags < p> < /p>

(remove spaces for these to work, I added spaces because otherwise the forums parses it as html lol)



Hrt Icon 0 players like this post! Like?

Fella (#76715)

Sinister
View Forum Posts


Posted on
2016-12-02 03:09:43
ah, thank you so much! :'D



Hrt Icon 0 players like this post! Like?

Rift (someday clean
paws) (#93115)

Deathlord of the Jungle
View Forum Posts


Posted on
2016-12-13 11:09:50
~o~ I might cry! I've been looking for CSS for so long... I plan on making a site some day, so I wanted to start learning CSS early, and my plan was to make my own CSS code for my den and for a sales thread (will CSS work on threads, or would I have to revert to basic HTML?)... I'm still a bit confused on some things in here, but I'll try it out and see if I can figure it out on my own. Thank you so much for this!



Hrt Icon 0 players like this post! Like?

Luxaeus [hiatus] (#78363)


View Forum Posts


Posted on
2017-01-28 11:09:53
Sorry if this sounds ignorant, but where would we put the #pride.table .top in the format:

Body {
color: #3D4F47;
background: url('http://static.lioden.com/images/nightBG.jpg');
background-attachment: fixed;
}

Or do we put it after the format. Also, what will it do exactly? Change the color?



Hrt Icon 0 players like this post! Like?

johanna mason
apologist (#98039)

UwU
View Forum Posts


Posted on
2017-02-01 00:39:55
I can't seem to get this down for the life of me. I'm trying to use this, and I have no idea if I'm doing it right or anything. Can someone help?

{body
color: #FFFF62
background: (http://www.md-health.com/images/1HT02933/lemons.jpg)}



Hrt Icon 0 players like this post! Like?

Fea [eyup chuck] (#42722)

Notable Lion
View Forum Posts


Posted on
2017-02-01 01:30:37
@Grientea:

the 'body' part goes before the opening curly bracket. c:

body {
stuff: stuff;
stuff: stuff;
}



Hrt Icon 0 players like this post! Like?

Fea [eyup chuck] (#42722)

Notable Lion
View Forum Posts


Posted on
2017-02-01 01:32:42
@Ace

That is a new selector and you would have a new rule for it. Example:

body {
background-image: url();
}

#pride {
more: stuff here;
}



Hrt Icon 0 players like this post! Like?

Firestar102🔥 (#79468)

Lone Wanderer
View Forum Posts


Posted on
2017-02-03 18:45:41
omg everyone who is commenting knows what this is talking about i'm so confused i don't even know what most of these words mean but i want to code a little and what i can do which isnt much IS fun but i just cant figure it out



Hrt Icon 0 players like this post! Like?


Edited on 04/02/17 @ 01:47:39 by Firestar102 (#79468)

Fea [eyup chuck] (#42722)

Notable Lion
View Forum Posts


Posted on
2017-02-03 21:55:45
@Firestar:

I can't teach you, sadly, but this might: Codecademy. I used this to start learning a few other languages. It's very nice guided tutorials. c:



Hrt Icon 0 players like this post! Like?

Firestar102🔥 (#79468)

Lone Wanderer
View Forum Posts


Posted on
2017-02-04 05:16:02
Thx ill look at it once i get internet bqck on my laptop



Hrt Icon 0 players like this post! Like?

🌸 Geo 🌸 (#62757)

Usual
View Forum Posts


Posted on
2017-04-17 05:26:32
How does it seem to work for google drive? Neither dropbox or googledrive links work for me



Hrt Icon 0 players like this post! Like?

SOUNDWAVE (#98036)

Wicked
View Forum Posts


Posted on
2017-04-19 03:39:52
Unable to make one sadly, anyone have a space background they could share????



Hrt Icon 0 players like this post! Like?

phaat II (#61165)

Renowned
View Forum Posts


Posted on
2017-05-22 23:36:44
This is so useful, and helped me to understand CSS better! Especially what to target xD Thanks so much! <3



Hrt Icon 0 players like this post! Like?

Fea [eyup chuck] (#42722)

Notable Lion
View Forum Posts


Posted on
2017-05-23 11:06:38
Great to know, Cryztal! <3



Hrt Icon 0 players like this post! Like?

Clover(main) (#101675)

Pervert
View Forum Posts


Posted on
2017-06-03 21:25:03
I'm so confused D:



Hrt Icon 0 players like this post! Like?







Memory Used: 633.18 KB - Queries: 0 - Query Time: 0.00000 - Total Time: 0.00420s