0

For example, I would like to know whether the color green will be on character AAA and BBB inside of div tag for all doctype such as xhtml, html5, html ?

<div style='color:green'>AAA<a>BBB</a></div>

But I tried it and AAA will be green and BBB will be black as default browser css color. In other words: parent tag style (defined by inline style or any other css method) won't affect child node style for all the mentioned doctypes. Right ?

where I can know the css spec in more detail about this ?

techsolve
  • 165
  • 2
  • 2
  • 11
  • 1
    I find it really unclear what you're asking.. – Josh Crozier Dec 08 '13 at 20:15
  • I think we shouldn't downvote this, OP seems to be confused with the inheritance and also, using invalid HTML, give some time to fix – Mr. Alien Dec 08 '13 at 20:17
  • Now you may understand my question more after re-edit. – techsolve Dec 08 '13 at 20:37
  • You want the link of website where it is specified about these rules?? – Alok Pant Dec 08 '13 at 20:38
  • I want to know my css concept is wrong or not ? And good website to talk about this that is welcome – techsolve Dec 08 '13 at 20:41
  • Well all the element will take the default property of the browser if you have not specified it.. like here it has taken BBB as black... So if you want to impose the color on all the child element you can try div.green * { color: green; }... – Alok Pant Dec 08 '13 at 20:43
  • Something like this? http://www.w3.org/TR/css-2010/ http://www.w3.org/TR/CSS2/ – Alok Pant Dec 08 '13 at 20:45
  • Doctype is an HTML concept. CSS is about styling this HTML code. (graphical) Browsers have a **default** stylesheet but it's up to them to choose one for HTML 4.01 and XHTML 1.0. It's [something along this one](http://www.w3.org/TR/CSS21/sample.html) but there's no default for form elements for example: depends on browser AND OS (`fieldset > legend` selector in Firefox, `-webkit-appearance` in WebKit: kingdom of whatever they want) – FelipeAls Dec 08 '13 at 20:54
  • From your example pasted in jsfiddle and seen with Firefow/Windows, BBB is also green. But with `
    AAABBB
    ` it's blue (or purple if :visited) because there's a default CSS for links (links have an `href` attribute)
    – FelipeAls Dec 08 '13 at 20:58
  • why css will be different for with href or without href ? – techsolve Dec 08 '13 at 21:24
  • FelipeAls, you are right, I understand what you said, when I put href link in a tag the color is changed to blur/purple. Where Can i find all those default browser css color ? – techsolve Dec 09 '13 at 05:08
  • it is asked before in http://stackoverflow.com/questions/6867254/browsers-default-css-for-html-elements – techsolve Dec 09 '13 at 05:51

1 Answers1

1

It is impossible to say.

There may or may not be a CSS rule with an !important flag that would override the green for AAA.

There may or may not be a CSS rule that sets the color property of the <a> element to something other than inherit.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • set inline style on every child node that will definitly be correct and safe but it will have a lot redunctant work and it will increase the html file size if not use css with css file with class – techsolve Dec 08 '13 at 20:45