Quiz
- What specifically is CSS vs HTML? Would using an ID selector (on the html file) be HTML or CSS?
They are different languages for different purposes.
HTML is a language about page structure: what is a part of what. Eg, EM text inside a P (paragraph) inside a LI (list item) inside an OL (ordered list) inside a SECTION inside an ARTICLE.
CSS is about style. So, you can put a box around that article or a colored background to the LI.
ID are used in *both* languages, because it's a way of identifying some element that you want to style.
-
Can we go over question 3 please?
What's special about giving an ID to an element? (check all that apply) A. Allow it to be a target of a URL B. Allow it to be styled uniquely C. Allow it to be a block element D. Allow it to use web fonts Answer Key: A,B
- Usage of ID for html and the usage of fragments sounded
interesting, but it would be nice to talk a little bit more about how
they are used and their importance!
Sure. They're really useful in URLs. In making the readings and lecture notes, I use software to automatically assign an ID to every section, and generate a hyperlink to that section. Very useful.
They are less commonly used in CSS just because they can, by definition, only style one thing. Still, sometimes that's what you want to do.
- How do ID works for URLs, can you explain more?
You just assign an ID to the place you want to be a target, then use the hash tag in the URL.
- How does the id attribute differ with absolute vs relative URLs?
It doesn't. It comes at the end of the URL, and so it works exactly the same way whether the URL is relative or absolute.
- Why don't borders have height?
They just have one dimension, their thickness, which is named
width
. Their length is determined by the dimensions of the element. Look at the box around this answer. - The CSS properties
All of them? I can't go over all of them. Can we get some nominations?
- I'm still a little bit confused about CSS units, in particular em and rem.
EM is the size of the current font, like 10px or 16px. If the font changes, and you want the length to change, EM is really useful. I use it for things like margin and padding.
REM is pretty much the same, but it's the size of the font for the "root" element (the BODY) rather than the current element. So if the BODY is 16px font and I'm in an H1 that is 2x bigger, an EM is 32px but a REM is 16px.
- Can we do a demo of using normalize.css and explain it a little
bit more in class? I'm kinda confused how and why we use that.
Sure.
- I don't know how to use div and span.
They're no different from SECTION or EM, respectively. They just don't have any meaning.
- Could you explain inline styling in HTML?
The reading didn't discuss inline styling at all, because it's not considered best practice nowadays. If you have a special reason to use inline styling, talk to me about it.
- Is there ever anything in CSS that's not in the { } brackets? (besides the selectors)
I don't think so.
- nope :) this seems way simpler than the HTML itself
Really? I can't agree with you, but I'm glad you're finding it simpler!
- I think I just want to practice using everything so that I can understand my different options.
For sure!