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



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?


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

Good to know! Great question!


Agreed with coder_brewer. I always wondered that myself!


So how do you style you browser tab?


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.


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


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


The icon you are talking about is called a “favicon”: .
You can add either of the following link elements in the of your html file. You have a lot of other info on the wikipedia article, including file formats, size, etc.

<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
<link rel="shortcut icon" type="image/png" href=""/>


Good question :smiling_face_with_three_hearts: and thanks a lot for your answer