! HTML/CSS Cheat Sheet

NebulaNumbat

Info


Created
2 years, 3 months ago
Creator
NebulaNumbat
Favorites
2900
Trade Listing
Free

Profile


Note: This cheatsheet was originally made for personal uses, so it's very crude and doesn't have many explanations yet. However I realized it could be useful for many people who want to do some quick tweaks in codes, so I decided to make it public. I'm still working to refine it and make it the most comprehensible as possible. Thanks for understanding!
Also note that while I had Front end classes this is mainly self taught knowledge, and I'm obviously not 100% certain about everything. I tried to make the easiest to understand :)
If you feel like there's something I'm missing/ some more in depth explanation feel free to comment/ dm me. Any bumps are appreciated

Do not hesitate to question! I'll try my best to help

** Also english is not my first language and I type like a horse sometimes lol. So sorry about any grammatical mistakes :p

HTML Cheatsheet

Some tags and their explanations, these are mainly for toyhou.se users. Enjoy!


Resources

w3school - Go there. I cant stress this enough. This is the best site to learn HTMl. Its all free, no account needed. Just show them some love ^^
circlejourneys' toyhouse editor - I use this exclusively to edit th codes. It works like the site and it already has bootstrap and fa codes installed, so this is a must-use
Get Bootstrap - Everything bootstrap with simple and easy explanations

HTML Element

Before we start you need to know some things about HTML. This is a cheatsheet, so I won't cover everything. So if you need help don't hesitate to check out the resources above. This is a little intro to people who don't know anything about HTML I'll explant tags, divs etc. So feel free to jump this

Tag - a tag is any element inside < > there is a variety of tags, some used for text, other for placements etc. So when I say 'the p tag' it means <p> </p>
Important: Almost all tags have an opening <p> and a closing </p>. but some tags, sile image <img> and break <br> don't need it

Classes - classes are a type of css documentation. Thety are used to decorate various elements with the same css withput needing to repeat it. I won't explain how to create classe since this is a preuim only-feature, and i don't want to confuse anyone. Keep in mund that In free th classes are only used to apply bootstrap
The classes are declared inside the desired tag
Exemple: <p class="text-info"> text </p> becomes text Important: you can use more than one class. They are separated by spaces only ex. class="text-info text center card"   There is no limit to how many classes to use

Style and attribultes - style is used to decorate (or stylize) your tags! They are the fun part of coding! You can put a style in almost anything. From texts and images to divs and videos! You start declaring the style inside the tag, just like clases: <p style=" color: blue "> text </p>.
Important: style attributes are separated by ; if your style is broken you probably forgot a ; somewhere.
Exemple:
<p style="background-color: #ffcfba; padding: 5px; border: 2px dashed #784e3c; border-radius: 5px; text-align: center; "> text </p>.

a text goes here!


(you'll learn how to do this kind of stuff in this cheatsheet!)

Note: You can use sty and css interchangebly! Just remember: style will overrride classes by default! so pay attention for conflicting info!
Text

We communicate using text everywhere so having an understanding on how the computer interprets if is pretty useful!
Text types
<p> This is the tag for normal text
<b> It makes the text bold!
<i> It makes the text itallic!
<a> this makes a link! the syntax for linking something is <a href="LINKHERE" > text </a>


Text size

<h1> Makes the text big

<h2> Makes the text big

<h3> Makes the text big

<h4> Makes the text big

<h5> Makes the text big
<h6> Makes the text big
But what if you want some super specific font size? you can add style=" font-size: 20px " for a text like this!


You can also use bootstrap to change the size of your text! Using the class display

Ex.

<p class="display-1">display one</p>

display-1
display-2
display-3
display-4


Text color
If you want to change the color of the text you need to add color: color inside style, like this:
<p style="color: red"> this text is red! </ p> this text is red!
HTML has some colors already like red blue gold and even lavender but for a better control you can use a hex value like this
<p style="color: #42C4A1"> this is a teal text!
Or even rgba, like this: <p style="color: rgba(255, 137, 79,1); "> this is an orange text!
With RGBA you can even have different levels of opacity! <p style="color: rgba(0, 0, 0,0.5)"> this is a black text with 0.5 oppacity



Changing fonts
You can use and import a variety of fonts web-wide, but Toyhouse has a limited collection for free users
style=" font-family: 'garamond' "
a text in the Garamond Font!


The size of the fonts can vary, so remember to check your code once in a while to be sure nothing is too big or small;


Web safe fonts - These fonts will work on any device
Arial
Verdana
Helvetica
Tahoma
Trebuchet MS
Times New Roman
Georgia
Garamond
Courier New
Brush Script MT

Toyhouse fonts
Andale mono
arial black
book antiqua
calibri
comic sans ms
georgia
helvetica
impact
symbol (Symbol)
terminal
webdings (webdings)
wingdings (wingdings)
zapf dingbats


Span can be used inside other tags
<p> this <span style="color: red"> word </span> is red </p>
this word is red

Colors n Styles

Colors
 Lets talk colors! you can change the color of something by adding color: #ffffff inside style Color will change the color of text and shadow inside that tag/div to the desired color;
<p style="color: #42C4A1"> this is a teal text!


Bootstrap Text colors
 Bootstrap has some pre made colors. They are useful on Toyhouse because they are adaptable to any theme. Contrary to normal colors they need to go inside class not style
<p class="text-primary"> Primary colored text <p class="text-success"> Success colored text <p class="text-warning"> Warning colored text <p class="text-danger"> Danger colored text <p class="text-info"> Info colored text <p class="text-white"> White colored text <p class="text-light"> Light colored text <p class="text-dark"> Dark colored text <p class="text-secondary"> Secondary colored text <p class="text-muted"> muted colored text

Background-colors
 Background colors can be used in almost any tag, they work like this
<p style="background-color: #42C4A1"> this element has a teal bg!


Bootstrap Background colors
 Bootstrap has some pre made colors. They are useful on Toyhouse because they are adaptable to any theme. Contrary to normal colors they need to go inside class not style
bg-primary
bg-success
bg-warning
bg-success
bg-danger
bg-info
bg-white
bg-faded
bg-light
bg-dark

Background Images
 Background images can be a little more complex, but they are easy to understand:
Syntax
<div style="background-image: url('URL')>
url = the adress of the image
Exemple
<div style="background-image: url('URL')>
url = the adress of the image

<div style="background-image: url('https://images.unsplash.com/photo-1468276311594-df7cb65d8df6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80')"></div>


* The background will, by default try to fill the size of the size of the div by repeating, and its position will be center

Background-size:
background-size: auto (default)
background-size: contain
background-size: 100px (any value)
background-size: cover

Background position
background-position: center (df)
background-position: bottom right
background-position: 10% 54%
background-position: 42px 30px

Background-repeat

*notice how all the divs have the same size

background-repeat: repeat (default)
background-repeat: repeat-y
background-repeat: repeat-x
background-repeat: no-repeat

Background-attachment

*scroll the page to see the differences
**all the div have background-size: cover

background-attachment: scroll (df)
background-attachment: fixed
background-attachment: local
Scroll this div to see the background image scroll with it! Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sollicitudin elit sed tellus blandit viverra sed eget odio. Donec accumsan tempor lacus, et venenatis elit feugiat non. Duis porta eros et velit blandit dapibus. Curabitur ac finibus eros. Duis placerat velit vitae massa sodales, eget mattis nibh pellentesque.

Borders
 Borders surround your element. They work like this:
<p style="border: 2px solid #42C4A1"> this is a teal solid border!
the basic syntax is border: width(px) style color
Border styles
solid
dotted
dashed
groove
double

Border Radius
Border-radius is used to make your borders rounded, not matter the style
the basic syntax is border-radius: (int)px or especifying for all four courners, in a clockwise direction: border-radius: (topLef)px (topRight)px (bottomRight)px (bottomLeft)px
border-radius: 50px
15px 50px
10px 20px 30px 40px
5px
100px

Shadows
Box shadow
  Box shadow is used for divs, and when you want n element to have a shadow around it
<p style="box-shadow: 2px 2px 5px"> box-shadow </ p> box-shadow
with the syntax being: box-shadow: dislocation right-left dislocation top-bottom shadow blur color[optional];

box-shadow: 0 0 5px
box-shadow: -5px 3px 1px
box-shadow: 10px 0px 15px
box-shadow: -5px -5px 1px green
box-shadow: 0px 0px 9px #FF894F

Text shadow
  text-shadow is very similar to box shadow, but it works for texts. It can be used on p, b, i and even Font Awsome Icons
<p style="text-shadow: 2px 5px 3px"> text shadow </ p>text shadow

text-shadow: 0px 0px 5px text-shadow: -1px -1px 1px red

text-shadow: 0px 4px 2px

text-shadow: 0px 0px 5px

text-shadow:5px -6px 3px


Gradients
background-image: linear-gradient( direction/deg , color, color);

linear-gradient( #D1CFE2, #7EC4CF);
linear-gradient( 170deg, #EF476F, #06D6A0);
linear-gradient( 170deg, #EF476F, #06D6A0);
to right, #F29559, #F2D492 10%, #283845 20%);
repeating-radial-gradient(#BEFFC7, #9AA0A8, #334E58)
Font awsome icons

Those little icons you keep seeing everywere
They're already imported into toyhou.se, so don't need to worry bout it

You can find all the possible icons here

Fa icons are always created on a <i> tag, like this:
<i class=" fas fa-heart"></i>
The fa at the start is crucial for the icon to work, but it can be changed to become different styles:
fas / fa-solid
fad / fa-duotone
far / fa-regular
fal / fa-light
fa-thin
fab / fa-brand (exclusive for brand related icons)
They can be stylized like any other text:


Animations

Fa has a variety of animations! However not every browser supports them. If the icons are static to you this means your browse can't display them
These animations work for every icon!

Exemple:
<i class=" fad fa-spinner fa-spin"></i>  

fa-spin
fa-spin-pulse
fa-beat
fa-fade
fa-beat-fade
fa-bounce
fa-flip
fa-shake

Links Fa Icons can be used as links!
Syntax:

<a href="linkhere" title="Click Me!"  >
     <i class="fas fa-link"></i>    
</a>
The link can be stylized, like shown above
Collapse
A collapsable div is a hidden block of information that can be triggered by a link (see <a> above for the syntax);
A collapse works like a completely normal div, so you can have absolutely anything inside of it;

First: What is a ID? - A Id is a attribute you can give an html element to make it unique. This Id can be used to reference, link, or call said element later;

Link syntax:
<a data-toggle="collapse" href="#ID" role="button" aria-expanded="false" aria-controls="ID"> </ a>
Collapse syntax:
<div class=" collapse " id="ID"> </ div>

Remember:
  • The id must be exact in all places (excet inside href, where it has # in front to sign it as a id)
  • I recommend not modifying the collapse div. If you want to change colors, make it a card etc. create another one inside of it
  • You can create collapses inside collapses!
Exemple:
Code:

<div class=" collapse " id="ID"> </ div>
<a data-toggle="collapse" href="#exeVideo" role="button" aria-expanded="false" aria-controls="exeVideo"> Click for a video! </a>

<div class="collapse" id="exeVideo">
<iframe src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?modestbranding=1" class="mt-4" style="height: 100px; width: 200px">
</iframe>
</div>
Result: