quinnfield / quinnfield.github.io

MassArt’s Web 304 homework
http://slides.com/amandacheung/web-design
0 stars 0 forks source link

Can write dotted border in a better way #12

Closed acacheung closed 7 years ago

acacheung commented 7 years ago

https://github.com/quinnfield/quinnfield.github.io/blob/master/dobot/style.css#L31

You can use the :not(:last-child) selector to make this more maintainable. What happens when more shop items get added? Your CSS system should allow for those kinds of changes

quinnfield commented 7 years ago

When I use this code it puts a border at the top, and I only want it between those articles. article:not(:last-child){ border-top:1px dotted #6d7171;}

How would I do that?

acacheung commented 7 years ago

Currently, your code states that all articles should have a border-top and then removes all borders from the article that is third to last. Rather than this, it would be better to say all articles except not the first, should have a border-top.

quinnfield commented 7 years ago

Apparently my first article doesn't register as first but second. When I try either not(:first-child) not(:last-child) the border doesn't go away from the top. So when I use not:(nth-child(2)) it works but I know it should I have been using the first child? What should I do differently? Thank you!

acacheung commented 7 years ago

it's being considered the second child because header is coming before it in the parent container. you can use nth-of-type instead. the other solution would be to create a div to wrap all your articles but i wouldn't suggest that because it means creating an extra html element without really needing to