Hi, Hi, I would like an assessment for MDN assessment page for Tables Task.
here is a link to my solution of the table https://glitch.com/edit/#!/cord-aquamarine-pickle
Thank you.
Hi, Hi, I would like an assessment for MDN assessment page for Tables Task.
here is a link to my solution of the table https://glitch.com/edit/#!/cord-aquamarine-pickle
Thank you.
Very well done, @Honlim_Wong!
Everything looks like it should. Congratulations!
You could save some code with more generic text-align
selectors. The alignment is the same for thead
and tbody
, so we can just use tr
. Additionally it doesn’t matter if the child is a th
or td
, so we can also remove them and just use :nth-child()
:
tr :nth-child(2),
tr :nth-child(3) {
text-align: right;
}
tr :nth-child(1),
tr :nth-child(4) {
text-align: left;
}
Enjoy your sunday!
Michael
Thank you, the codes looks much more tidier after retried. Now I know the :nth-child(n)
can be an independent selector.
Yeah, it’s a nice fact to know about. As we often use pseudo-classes to style hover effects of links (a:hover
) or input focus (input:focus
) it is easily forgotten that they can also be used on there own.
I just come to realized that you can’t find pseudo classes and pseudo elements in HTML Document.
You can target and style HTML element(s); add a class/ID to HTML doc and style them, but you won’t find pseudo classes and pseudo elements in HTML Doc!
It seem that they are designed intentionally for very specified purpose.
You are right, that you can’t see them in the DOM, hence the name “pseudo”. Both have in common that they are attached to “real” elements and can therefore be style through those “real” elements. You can think of pseudo-classes as states of the element they are attached to. Those states can be toggled in the FireFox DevTools inspector:
I recommend reading MDN | Pseudo-classes and pseudo-elements to get an overview.
Michael