Extra information about CSS from Rob
This is a question from Jade in the Forum:
I would really like this section to include some more, especially advanced things, such as…
- Styling specific images or elements, say an image in a div. Or an image in a list.
- Styling lists, making a sublist type thing.
- How to do those really big banners that go the full width of the page and seem to work everywhere. You see it with responsive design a lot.
- CSS Sprites. Especially the positioning stuff if you have say a 9×9 grid of images.
- How to use th and other table stuff effectively and to style and understand how it works.
- Webfont kits would be nice to include, but I do already know that one.
- An explanation on inheritance and where we might run into its issues.
- The use of !important and @media queries.
I know this should be basic css but these are pretty basic things I still haven’t wrapped my head around and I am hoping for some instruction on them like this course is outlined as. Trying to learn it by myself clearly isn’t working out lol.
Answer from Rob
Hi Jade, A lot of this information can be found on the W3C site here: http://www.w3schools.com/css/ I’ll try and run through a summary though:
- You can specify an element type within an element type to be styled in a certain way using a combination of selectors. More details of this are here: http://www.w3schools.com/css/css_combinators.asp
- You can style lists using the list-style-type declaration for a list. More details can be found here: http://www.w3schools.com/css/css_list.asp
- What you’re referring to is known as a jumbotron. This can be accomplished with the CSS you’ve learnt so far (it’s basically just a big div with a 100% width and a height of your choosing). Often though, it’s commonly implemented using Bootstrap, which is covered later in the course.
- Image sprites should be created with each image in a fixed size cell in a grid so that you can specify an offset to display using CSS. You can find how to do this here: http://www.w3schools.com/css/css_image_sprites.asp
- What specifically do you mean by using table stuff more effectively?
- Web fonts are handy, but I didn’t want to throw too much in the course too early on, as it could detract from learning the more fundamental basics first. More info can be found here though: http://www.w3schools.com/css/css3_fonts.asp
- Agreed that could be discussed more in the course. I’ve added it to the feedback doc here: https://docs.google.com/spreadsheets/d/1xqFnzC80KD5sEC58LjNIBZtJ6gPBcl_32wmaoCMJiTo/edit#gid=1847300764 There is an article on inheritance here that you may find useful in the meantime though: http://www.w3.org/TR/CSS2/cascade.html
- The !important rule simply allows you to override an inherited property with another one. There’s a good article on this here: https://css-tricks.com/when-using-important-is-the-right-choice/ The @media rule can be applied as a selector to specify certain types of device (e.g. use this CSS if the media is for screen, use this one if it’s for speech, use this one if for print). There are other mediums that you can specify with @media, but most of them are now depreciated due to the advent of responsive design.
Reply from Jade:
Hey Rob!
1. I’ve tried to learn through other websites for ages now and it’s not working, which is why I was hoping for instructions on it like how you’ve done your videos. I have a hell of a time selecting elements in elements and no amount of googling has helped before. I think it’s a case of waiting for the penny to drop and I hope a different approach will help.
2. I mean how to make them nice and understand the li and stuff in the CSS, which parts to style. Also how to indent sub list items and what is the best way…is putting another list inside a list item the way to go or should I do it another way?
3. Jumbotron! That helps a lot, thank you!
4. I am pretty scared of doing this because of the positioning stuff but I will give it a go. I’d like to learn how to do it with SVG files which can scale properly too, if you have a link on that :).
5. I don’t know where/how to use the and the new table elements, or how to style them. I feel like I can build a table and apply classes to the rows/cells but I don’t know how to style a table beyond that. I don’t know how to make them look nice. Most of my tables, for that reason, are invisible.
6. I understand what you mean, but it isn’t too difficult to do once you’ve seen it done or done it once :). I use font squirrel’s kits so it’s pretty simple for me at least :).
7. Thanks for the inheritance link!
8. I have used !important enough to know it means that it has to be done, I just didn’t understand how it got to that point. It definitely would be a good thing to use in any inheritance lesson you update the course with or put into a future course. Also, I did believe it only worked on IE but I think that’s changed over time.As for @media it’s extremely confusing. The responsive design thing is extremely confusing. Honestly, I used to use a 960 grid to design and I tried to make a site with bootstrap and then foundation using my design and it was so far off it wasn’t funny. It was absolutely awful! I don’t know how to use them, what resolutions to pick, or even what specific css should be in there. I like to think of only widths and heights sort of things, and then leave the colours etc outside of it to avoid huge css files but that’s just me.
Recent Comments