Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
131
rated 0 times [  138] [ 7]  / answers: 1 / hits: 22697  / 13 Years ago, mon, august 22, 2011, 12:00:00

I'm for years using something like this in my HTML for elements which should be hidden:



<div style=display: none></div>


It's ok, but I can't stand in-line styles anymore.




  1. Hiding elements programatically in JavaScript window.onload event is too late -- it will flash on the screen.


  2. I can create CSS class 'hidden', but with browser's aggressive loading strategies (like in Opera) the block may appear for a second (before CSS is loaded).




Is there any better way?


More From » html

 Answers
111

As far as I know the class=hidden method is the best and most commonly used. I suggest you use class=hidden.




but with browser's aggressive loading strategies (like in Opera) the block may appear for a second (before CSS is loaded).




I don't use Opera, but if any browser loaded the page before applying styles then a lot would look wrong, not just your hidden elements. I don't know of any browser doing this.


[#90490] Friday, August 19, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tatyanna

Total Points: 552
Total Questions: 96
Total Answers: 96

Location: Cook Islands
Member since Thu, May 21, 2020
4 Years ago
;