开发者

Position:absolute in HTML5

开发者 https://www.devze.com 2023-03-23 02:29 出处:网络
Is there any problem If i use position:absolue property in HTML 5 ? position:absolute;left:somepx;top:somepx;

Is there any problem If i use position:absolue property in HTML 5 ?

    position:absolute;left:somepx;top:somepx;

Will it work on all browsers or does the syntax go upside down ? Im using the

      <!doctype HTML> 

and developing the html using images and with some text, Just placing them in a good looking way using the position:absolute.And im developing usin开发者_StackOverflowg my internet explorer probably its version 7 I think so.But im worried will it work on other browsers like mozilla and google chrome with no error.Will it remain the same way on all browsers? becuase the stackoveflow or google any webpage looks in the same way in all browsers.I just wanted to know what standards they follow that makes them look same on every browser.

Please just let me know is there any harm or pitfall using the position:absolute.Thank you in advance


It seems you make some mistakes when you build your websites.

  • using absolute positioning where you shouldn't. It is not appropriate to use position: absolute to make a complex layout. Consider looking for some tutorials to learn how to build a layout using especially float, clear, margin and padding CSS properties. Use absolute positioning only where it is explicitly required.
  • using non standards-compliant browser during website development. IE7 is quite old browser with buggy support for web technologies. This may cause that your website will display fine only in IE7 and messy in every other browser. What you have to do is to develop website in standards-compliant browser (no matter what browser, just make sure you use the latest version available) and then check the website in older browsers (and possibly fix bugs that appear). Don't forget to check the website in all browsers used by your visitors. Compatibility tables like those at QuirksMode are often useful.

Back to original question, browsers don't distinguish between versions of HTML (there is just standards and quirks mode, but you don't need to care about them because you're using doctype that triggers standards mode in all browsers); so there's nothing more to be aware of. Absolute positioning should (and in most cases, will) work well in IE8+ and all widely used versions of Firefox, Chrome, Safari and Opera. Once again, you're supposed to test your website in all widely used browsers; you'll discover possible browser bugs and incompatibilites then.


Another interesting thing to look at is this:

http://ie.microsoft.com/testdrive/HTML5/PositionedFloats/Default.html

It may very well be available soon and will probably be a lot better for what you want. For now, do not JUST use Position:absolute, as people have said, it is a really bad way of positioning things and should only be used under very specific circumstances.


Well it has nothing to do with HTML5, it is basic positioning.

And it is not a straightforward process to get your site to display the same in all browsers, you should take a look at resetting style sheets or just test your site in a lot of browsers.
Especially older browsers have a way of changing your design.


absolute positioning is part of css3. html5 is just a combination of javascript+html+css with unique features. so.it should work with all the browsers. but how all the browser will display, you need to chek it in chrome,mozila,safari,opera...etc in recent versions. browser compatibility may be issue some time.so,don't worry ,it's better to chek and fix the variations.

0

精彩评论

暂无评论...
验证码 换一张
取 消