What is the comparison between actual pixels and text size in Internet Explorer?

Can you determine the actual font size in pixels corresponding to the following text size options in Internet Explorer?

  • Largest
  • Larger
  • Medium
  • Smaller
  • Smallest

In a web development project, I am looking to achieve a similar functionality to adjust the text size of application controls based on the selection from the above list. However, I am unsure of how many pixels I should programmatically set for each selected item.

Your assistance on this matter would be greatly appreciated.

Answer №1

Experimenting with the current style using Javascript, utilizing the following HTML:

<!DOCTYPE html>
<html>
  <head>
    <title>Testing font size</title>
  </head>
  <body>
    <p id="test">This is just a test</p>
    <script>
      var elem = document.getElementById('test');
      elem.innerHTML = 'The current font size is '+elem.currentStyle.fontSize;
    </script>
  </body>
</html>

(or simply view it on this fiddle)

This generates the list below:

  • Text size Largest: 16pt (= 21.3px)
  • Text size Larger: 14pt (= 18.7px)
  • Text size Medium: 12pt (= 16px)
  • Text size Smaller: 10pt (= 13.3px)
  • Text size Smallest: 9pt (= 12px)

Please note: After adjusting the text size, refresh the screen (or rerun the fiddle) to update the script.
Another important point: currentStyle is a specific property that functions only in IE.
Lastly: The pixel values were calculated based on a DPI of 96; results may vary on monitors with different DPI values, so caution is advised.

Answer №2

In accordance with the specifications:

The user agent provides specific guidelines for mapping absolute sizes to HTML heading and font-sizes. The 'medium' value represents the user's preferred font size and serves as the middle reference point.

HTML Values : xx-small  x-small  small  medium  large  x-large  xx-large     
Font sizes  : 1         -        2      3       4      5        6         

Relative values would adjust accordingly to go larger or smaller relative to the table entries based on context:

Possible options include: [larger | smaller]. For instance, if the parent element has a font size of 'medium', selecting 'larger' will increase the font size of the current element to 'large'. If the parent element's size does not correspond directly to a table entry, the browser may interpolate between entries or round off to the nearest one. In cases where numerical values exceed the keywords, the browser might need to extrapolate values from the table.


Bear in mind that these guidelines are intended for the browser's reference and do not guarantee exact sizes in all browsers. However, they provide a general overview of what to expect.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating a range using v-for directive in Vue

For example: range(3, 5) -> [3, 4] range(5, 10) -> [5, 6, 7, 8, 9] I am aware that we can generate range(1, x) using v-for, so I decided to experiment with it like this: // To achieve the numbers in range(5, 10), I set (10 - 5) on `v-for` // and t ...

Relative positioning can break the background-clip attribute for text elements

I am experimenting with using background-clip: text on an element that contains some child <p> elements. I wanted to enhance the design by adding some absolutely positioned :after elements to the <p> tags, covering up the text for animation eff ...

Trigger the ASP .NET OnCheckedChange server event using JavaScript

One issue I encountered is related to a checkbox with an OnCheckedChanged event. Occasionally, I modify the checked status of the checkbox using javascript. However, when this occurs, the OnCheckedChanged event does not trigger. Is there any method to ens ...

Gulp is ensuring the destination file remains unchanged

I'm encountering an issue with gulp in my project. I've set up a process to automate the compilation of source and styles into a single file using gulp. However, I'm facing a problem where it doesn't want to overwrite the `application.j ...

The image fails to load once the AI-generated image is complete and the response process has concluded

After a long hiatus from development, I am diving back in and acknowledging the rustiness of my skills. Any syntax or formatting errors encountered are preemptively apologized for. Currently, I am immersed in a small web app project that involves taking a ...

How can we redirect using an OnClick event handler in React.js?

I've been doing a lot of reading and trying to understand how to redirect using withRouter in React. However, I came across some information stating that when onClick occurs, the page should be redirected to a specific link. Additionally, I learned th ...

Understanding how to read a JSON response when the dataType is specifically set to JSONP

I am attempting to send a JSONP request for cross-domain functionality. The issue is that my server does not support JSONP requests and interprets them as regular JSON, responding with an object: {result: 1} Below is the AJAX request I have made: jQuery. ...

What is the best way to ensure the second navbar stays at the top when scrolling, after the first one?

Looking for a solution to create a navbar with two distinct sections for contact info and the menu. The goal is to have the contact info disappear when scrolling down, while the menu remains fixed at the top of the page. When scrolling back up, the menu sh ...

Why doesn't the 'Range' input type slide on React.js documentation, but it does on CodePen?

Can someone help me figure out why my range slider is not working in my React app? I copied the code from Codepen where it works fine, but in my app, it's not functioning properly. The slider doesn't slide when dragged and clicking on it doesn&a ...

Adding parameters to a URL is a common practice

"Adding additional information to a URL that was previously included?" I apologize for the confusing title, but I can't find a better way to phrase it. Perhaps an example will make things clearer. Let's say I have URL 1: http://example.com/?v ...

javascript design pattern - achieving unexpected outcome

In the code snippet provided, the variable a is turning out to be undefined. Are you expecting it to display the parameter value passed in the parent function? function test(a) { return function(a) { console.log('a is : ' + a); // Ou ...

In my Laravel Vue JS project, every Put and Delete route method triggers a 302 error

I'm encountering an issue with my Laravel Vue JS application where the PUT and DELETE methods are throwing a 302 error. Here is the response from my localhost: And this is the response from my server: While everything works perfectly on my lo ...

When the browser is resized, elements do not change position

I am attempting to build a website with solely horizontal scrolling. Check out this demo for reference. My issue arises when I resize the browser, as the content (paragraph within the light yellow box) fails to reposition itself. Ideally, I would like that ...

The key you entered in local storage was not defined and the value associated with

Having an issue with my HTML signup form where the key is showing as undefined (email should be the key) and the value displays as [object Object]. Any help in resolving this problem would be greatly appreciated. Thank you. <!DOCTYPE html> <html& ...

generate a cookie within a pop-up window

Can someone help me figure out why my Modal Window with a cookie to display only once isn't working? I followed this tutorial at . Here is the link to my website: Here is my code: <div class="modal fade" id="myModal" tabindex="-1" role="dialog" a ...

obtaining Json format from an array: a comprehensive guide

Hey there, I am looking to convert my array into JSON format. Currently, my array structure looks like this: Array[0] abc: Array[1] 0: "English" length: 1 abc1: Array[2] 0: "English" 1: "Urdu" length: 2 Here is the structure that I want in JSON using Jav ...

Can someone please clarify how the nth-of-type selector functions?

I can't understand why the nth-of-type selector needs to be set to 2 instead of 1 for the first sibling of this type in the code. To see the code in action, check out this jsfiddle: https://jsfiddle.net/xj5hvn16/ If anyone could kindly provide an ex ...

What is the best way to prevent the use of "******" at the beginning of every line in Javascript/Node Bund

Update: I am currently working on a Node.js test project (utilizing WebPack). In the development builds (app.js), at the start of each line, there is /******/ https://i.sstatic.net/jZ5h6.png Since this seems to be common behavior, I am wondering if th ...

When using jQuery's .text() method, it updates the "source" content without affecting the actual DOM

Here is a scenario I am working on with jQuery: When the user clicks on a div An ajax call is triggered to save data in the database After receiving the callback, an update message is displayed <--everything good until here Now, if the user clicks on ...

Leveraging AngularJS $filter in conjunction with ng-disabled

I have a variable in my $scope that contains information about an election, including a list of voters with unique IDs: $scope.election = { voters: [ { _id: '123' }, { _id: '456' }, { _id: '789' } ] } Additio ...