croeltgen Posted November 17, 2010 Share Posted November 17, 2010 Hello,I have the following html:<body><img border="0" src="test.jpg" style="opacity:10.;filter:alpha(opacity=40)"onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100"onmouseout="this.style.opacity=0.1;this.filters.alpha.opacity=10" /><table style="opacity:1;filter:alpha(opacity=40)"onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100"onmouseout="this.style.opacity=0.1;this.filters.alpha.opacity=10"><tr><td>TABLE TEST</td></tr></table><p style="opacity:0.1;filter:alpha(opacity=10);background-color:green;"onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100"onmouseout="this.style.opacity=0.1;this.filters.alpha.opacity=10">P TEST</p></body>This works fine with img and table, but for <p> tag it only does the background= but ignores the opacity.It was my understanding that I can do style= in <p>, but why doesnt this work then?Thx, Link to comment Share on other sites More sharing options...
jeffman Posted November 17, 2010 Share Posted November 17, 2010 Works fine as is in my Firefox.I would suggest doing it all in CSS, however, using the :hover pseudoclass. mouseovers are pretty old school if you just want a style change. Link to comment Share on other sites More sharing options...
croeltgen Posted November 18, 2010 Author Share Posted November 18, 2010 my question was not so much about the mouseover stuff: I had added it for demo purpose.I reformulate my question then:In the following code:<body><img border="0" src="test.jpg" style="opacity:10.;filter:alpha(opacity=40)"/><table style="opacity:1;filter:alpha(opacity=40)"><tr><td>TABLE TEST</td></tr></table><p style="opacity:0.1;filter:alpha(opacity=10);background-color:green;">P TEST</p></body>why does the opacity work with img and table, but not with p tag?I tried also to add an id in the <p> and change the opacity in java script: same result - it does nothing. Link to comment Share on other sites More sharing options...
dsonesuk Posted November 18, 2010 Share Posted November 18, 2010 IF! you are talking about IE6 to IE7/Compatible, You won't believe this, I still can't believe it, but you have to assign width:100%; to the paragraph for it to work, Why people ever use IE escapes me, it was a complete scr@#%p from the start. Link to comment Share on other sites More sharing options...
jeffman Posted November 18, 2010 Share Posted November 18, 2010 Always test in more than one browser. If you can only test in one, always tell us which one. And, as dsonesuk explains, always expect trouble in IE. dsonesuk is providing the most common solution to the extremely annoying "haslayout" problem that only occurs in IE. You can Google that if you want more information. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.