In CSS, can we select any HTML element by using its tag name as demonstrated in this exercise?


#1

Question

In CSS, can we select any HTML element by using it’s tag name as demonstrated in this exercise? Could I even create selectors to target HTML elements in the head of a document? For example, can I change the color of tab text with a title tag selector?

Answer

No. CSS is used to style our pages. As <head> tag content is not visible on the page itself, we can not target this metadata with tag selectors.


FAQ: Learn CSS Selectors Visual Rules - CSS Setup Selectors - Tag Name
#2

Good to know! Great question!


#3

Agreed with coder_brewer. I always wondered that myself!


#4

So how do you style you browser tab?


#5

Whilst I’m only just learning CSS (and am relearning HTML as I haven’t done any in some time), as far as I know, you can’t style the tab text. It’s always uniform in all the browsers I use. You can add the little icon (don’t ask me how - been years since I last did it; hoping will learn again somewhere down the line!) but that’s about it.

Anyone with more knowledge, feel free to correct me if I’m wrong.


#6

The way that makes style in HTML is useful for me, i have big hand :v


#7

No. Not every tag, <head> Isn’t visible so you cannot Style The Head Selectors. :sweat_smile: