Skip to content

Instantly share code, notes, and snippets.

@caward12
Last active March 14, 2017 02:25
Show Gist options
  • Save caward12/580531fb0ea6422cf1c5b6e68e3d62f3 to your computer and use it in GitHub Desktop.
Save caward12/580531fb0ea6422cf1c5b6e68e3d62f3 to your computer and use it in GitHub Desktop.
html css basics

HTML

HTML skeleton

  • a boilerplate for the bare minimum of what you need for an HTML file - includes doctype, html, head and body tags

head

  • the <head> tag contains metadata about the document. Information in between these tags is not displayed. Could inlclude title, link to stylesheets

body

  • the <body> tag defines the document's body - what appears on the actual web page and can include text, paragraphs, links, images, tables, lists etc.

semantic tags

  • semantic tags clearly describe their content to the browser. These tags include header, footer, nav, article, section, aside, main etc.

non-semantic tags

  • non semantic tags do not describe the content they hold. They include div and span and are used for styling purposes mostly.

css

selectors

  • selectors in css are used to define how certain html elements are styled. There are simple CSS selectors - those that match exactly to HTML elements (p, h1, h2 etc.). p {background-clor: blue;} p is the selector

class selectors

  • class selectors identify a specific class used in the html document to target how it will be styled. .home-nav{background-color: red;} .home-nav is the class selector

id selectors

  • id selectors identify a specific id used in the html document to target how it will be styled. #nav-id{backround-color: yellow;} nav-id is the id selector

box model

  • the css box model is a box that wraps around every html element and consists of padding, border, margin (working out from the actual content). Padding is the first box around the content - it is transparent. The boarder goes around the content and the padding. The margin is the transparent area around the boarder, padding and content.

display property

  • defines how an element will be displayed. The defualt is either block or inline. Block elements start on a new line and take up the full width available. Block elements include p, div, h1..h6, form, header, footer, section. Inline elements do not start a new line and only take up the width necessary - allowing other elements to wrap around them. Inline elements include span, a, img. Inline-block elements are like inline elements but have a width and height. display none will hide an element - often used with javascript.

floats

  • float defines if an element should float where it is located on the page. It can be used to wrap text around images. An element can float right or float left.

clearfix

  • If you float an element that is larger than its container it will overflow outside of the containter. You can use clearfix to contain the element by setting clearfix {overflow: auto;}

lorem ipsum

  • latin dummy text used as filler text in priting, visual design, web design etc.

pseudo classes

  • defines a special state of an element such as when a mouse moves over it, visited or unvisited links. They are used like: selector:pseudo class {color: red;}

spaces, commas, dots

  • selectors that have a period with no space between them apply to those elements that have both selectors. selectors with commas between them apply to elements that have either selector. Selectors with a space between them mean that the second selector is a child of the first. Selectors with > between them means that the second selector is the direct child of the first.
@Carmer
Copy link

Carmer commented Mar 14, 2017

For pseudo classes - go through the nth-child stuff. It will be helpful later on.

Good work here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment