Mobiles, HTML, CSS (& laziness)

With regards to mobile websites on smartphones;

Assuming that:

  • HTML code is rarely a huge amount of data
  • Compressed JS files are not so heavy
  • Images are often loaded via CSS (at least could always)
  • It's the same sequence (PHP + SQL = HTML) on server-side.
  • It seems way faster to do this way and quite easy to maintain.
  • And even if:

  • It's not graceful at all (hide Useless elements instead of generating a sharp and beautiful HTML code)
  • Useless code is loaded and treated.
  • Best practices for mobiles websites don't recommend to do this way.
  • Is it a good idea to rely only on different CSS to create a mobile version of a website? (Actually on different header templates, in order not to load useless JS)


    It's probably a bad idea to serve HTML with elements that you know will be useless to your users.

  • Small amounts of kb make a difference on mobile download speed.
  • It means your CSS and Javscript need to be more complicated.
  • You users might see the content if the CSS or JS are slow loading.
  • It will take more processing power (I think CSS styles will still be applied to the hidden elements).
  • It's likely to be easier to manage on the server
  • But to answer the question "Is it a good idea to rely only on different CSS to create a mobile version of a website?";

    Yes if you want your mobile users to have the same content as your large screen users. Which you probably should as this is normally what the users want.

    No if you want to serve them different content.


    Speaking for Belgium, I know a lot of people are still on Edge instead of 3G and loading a webpage takes some time. If we would have to load pages made your way, we would indeed be loading a lot of useless code, giving us quite a bad experience. I'd suggest you stop being lazy and write your mobile websites the way they should be written. Think of your visitors and user experience; it honestly isn't that much of an effort.

    I think you basically answered your own question already. Like BoltClock said, do what you want, but I sure wouldn't recommend doing things your way.

    链接地址: http://www.djcxy.com/p/72084.html

    上一篇: 如何仅将jQuery Mobile用于其触摸事件支持(无UI增强)?

    下一篇: 手机,HTML,CSS(&懒惰)