Jump to content

Tag overpowering?


reportingsjr

Recommended Posts

Well, I was wondering that if you have a few tags nexted in each other then will the one closest to the info inside tem overpower all of the other ones styling effects? If you didnt catch what im asking here is an example code.

<span style="color: yellow;">   <span style='color: blue;'>	  Will this text be blue or yellow?   </span>   <span style='color: red;'>	  Will this text be red or yellow?   </span></span>

So, which tag will make the text what color in the end?Im guessing its te inside spans because there style gets parsed last so the browser goes "Make text yellow, make text blue, print text, make text red, print text" (Note, this is just how it would go in way of words).So what do you think?

Link to comment
Share on other sites

There's nothing wrong with that, it is valid in terms of CSS. CSS properties are inherited by child elements unless they get overwritten. There's nothing wrong with specifying one color on one element, and another color in a child element. In fact, there are several uses for it.

<span style="color: yellow;">   Yellow text   <span style='color: blue;'>	  Blue text   </span>   Yellow text   <span style='color: red;'>	  Red text   </span>   Yellow text</span>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...