2. More Html/CSS
2. More Html/CSS
Lesson objectives
Understand enough about HTML and CSS inorder to be able to move on to bootstrap tomorrow
Understand CSS is used to change the look and feel of elements on a webpage
Understand how to use CSS classes and selectors to change elements
Lesson time to deliever:
2 hours
Lesson Content
Slide Deck. This slide deck needs to be updated with what we will be covering. Use it & this lesson plan as a starting point for making your own slide deck. Skip the table slide.
Emmanuel Deck
Jacob Deck:
Html
Make sure to explain you must close every Tag
Pre/Br tags
How do you split this address up?
Line breaks in html
A line break is a seperation of text through the creation of a new line, we can use this to format text such as address lines to create a single text with a text on each new line.
We can accomplish this through the use of three different ways
Break tag - Seperates the line where the tag is used - has no ending tags.
Pre tag - Keeps the formatting for the text exactly the same including line breaks and spaces.
Using css styling: https://stackoverflow.com/questions/39325414/line-break-in-html-with-n
A Tag
A tags let you link to another website, page or even element
More on Divs
Go through Div tag. Explain usefulness: It is a general way to group together elements, especially for styling. Briefly explain and tell them we will be using in more depth when we get to css
What is a div tag? Div is a tag that we use to define a section / division in HTML. Also acts as a container for html elements to be styled in CSS
Class Ex: Practise <pre> <br> and <a> tags
CSS
Allows you to add styles. Styles change the appearance of an element and make it look lovely
Three ways of doing it:
The style tag allows us to do inline styles in the html
Can be a linked style sheet
Can use the style attribute on an element
Example of styling using style tag:
The style tag must be placed within the head tag
Style attribute
Explain what an attribute is
Display same with style attribute Get students to do it and save as a new file
CSS in a separate file
Display same with CSS in seperate file and linked on html page. Get students to do it and save as a new file
CSS Selectors
How to target element to be styled:
By tag
By element id
By class
Inform we have been using class and demonstrate by tag (e.g. the h2 tag)
See Jacob slide deck for full description of CSS selectors
The box model
The power of Divs
Last lesson went through divs. But didn't explain why so useful. Styling is one of the places as you can group together elements to be styled in a certain way
In this example we've styled all the text white, but styled the three blocks differently using divs
Closing to students
You can get CSS help from here: Css-Tricks
Html page |-> Css files |-> Js scripts
Teacher Recommendations:
Live server in vs code to live reload code
Have a split screen setup so don't have to switch screens as often.
Pre-prepare the html files for the exs for the students so can just jump right in and for example add the style attribute to an element.
DO NOT cover tables: won't be useful in next few days
What worked well in the past
What hasn't worked well in the past
Last updated