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 6630495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:24:44+00:00 2026-05-25T22:24:44+00:00

Following code sets the height of two div elements – one in inch and

  • 0

Following code sets the height of two div elements – one in inch and one in pixel.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>CSS 2</title>
<style type="text/css">
.div1{
    border:solid 1px red;
    height:1in
}
.div2{
    border:solid 1px green;
    height:96px
}
</style>
</head>

<body>
    <div class="div1">This is the content in div 1</div>
    <div style="clear:both">&nbsp;</div>
    <div class="div2">This is the content in div 2</div>
</body>
</html>

Now, even on changing the resolution of the screen the height of both the divs always remains same.

What I was expecting is that the first div (having height specified in inch) would remain same where as the height of second div (specified in pixels) would change.

Due to this behaviour, there are following things which are being unclear:

a. When we specify height of an element in ‘in’ then is it equal to the physical inch?

If yes, then when the resolution of the screen is changed, why the height of such an element changes?

If not, then what way can we relate the size of an element with the physical world dimensions?

b. How are pixel and inch related to each other.

Could anyone please guide at this or point to some useful link?

Thanks in advance.

  • 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-25T22:24:44+00:00Added an answer on May 25, 2026 at 10:24 pm

    The inch in css is a logical inch and not physical since most browsers cannot determine the physical size of the screen. By default this is set to 96dpi , hence 96px for each inch.

    Refer here

    My recommendation would be not to rely on inch/cm units but rather em based layout and use javascript for dynamic resizing as shown here : Dynamically Resizing Text with CSS and Javascript

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

Sidebar

Related Questions

I have the following code which sets up some custom form elements on the
I have the following code that sets a cookie: string locale = ((DropDownList)this.LoginUser.FindControl(locale)).SelectedValue; HttpCookie
The following code is in the /Courses/Detail action: [AcceptVerbs(GET)] public ActionResult Detail(int id) {
Why does the following simplified code not sets the font-size of the TextBlock to
I have the following code in my codebehind Page_Load function that sets the default
I have implemented an error style for textboxes using the following code. This sets
I have the following code: // button sets var sets = ['.diamond-colour','.diamond-cut','.diamond-clarity','.diamond-certificate']; // for
I've got the following code to schedule reboot jobs using Quartz. The code sets
Given the following code: class monomial { public: mp_real coe; int exp; monomial *next;
I have following code I want to test: public class MessageService { private MessageDAO

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.