Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1054561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:25:34+00:00 2026-05-16T17:25:34+00:00

Shouldn’t we use Pixel for anything in CSS if we are making a site

  • 0

Shouldn’t we use “Pixel” for anything in CSS if we are making a site for mobile devices?

px for layout and font. Should we only use em or % for everything on mobile sites?

and if i’m using <img> then should i defined height and width for <img> in HTML code? or it’s good to not to define. or i should define size in css for <img> also in % or em

Edit:

Note: Question is not again about px vs em debate My question is specifically for separate mobile site. when we are making separate mobile site with different domain or sub-domain.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:25:34+00:00Added an answer on May 16, 2026 at 5:25 pm

    Everything depends on the context. Like with CSS for desktop browsers, there are situations where using pixels is not a good idea (for example mostly for font sizes), and there are situations where pixels are still very useful (for example fixed layout).

    In general, avoid using pixels every-time you don’t need to. For example, there is no reason to do it for fonts: it’s not you, but the user who chooses if the font must be big on a high-res screen or not. Using percentages also helps you somehow to remember that a piece of text can never have an exact width and height, and force you to adapt your design.

    Now, sometimes, for cost or other reasons, you have to do fixed layouts, or at least some parts of a page, associating images and text, have to be fixed in size. In this case, there is nothing wrong to use pixels. If I have a <div/> with some text inside and a pretty 200×100px background, the most obvious thing is to set the width and the height of this <div/> to 200 and 100 pixels.

    if i’m using <img> then should i defined height and width for <img> in HTML code?

    IMHO, you never should do that. The size of an image is purely a layout/design thing, so it has nothing to do with HTML, but with CSS.

    Do you have to specify the size of an image in CSS? If you want your image to be displayed 100%, than no, you don’t have to: this is by default in every browser. If you want to scale it down and, for some reasons, you can’t scale the image itself than save the scaled image on server, than yes, you may want to specify the size of the image.

    Remember than sending a big image and scale is down on client side is always a bad idea. The visual quality might be affected, and the client will have to wait more to see the image appear.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why should I or shouldn't I use dirty reads: set transaction isolation level read
Shouldn't both be removed? Or does it mean we should use <small> ? Why
If you think it shouldn't, explain why. If yes, how deep should the guidelines
I've seen numerous people mentions that you shouldn't use widths and padding or margins
Shouldn't following command run myScript only at the runlevel 2. I noticed it executes
Shouldn't this be a pretty straightforward operation? However, I see there's neither a size()
Shouldn't PostBack be checked before Session protected void Page_Load(object sender, EventArgs e) { if
Shouldn't classes in DAL (customerDAL) be singleton? Since my controllers (customerController) exposes Shared Subs,
This shouldn't be so hard but I just can't seem to get this to
I know that we shouldn't being using the registry to store Application Data anymore,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.