Mobile device causing elements to resize unevenly

On my simple webpage, I have a combination of text and a table. Check out the HTML below:

<body>
<div id='stat'>
  <p class='subheading'>Stat of the Week: Average Final Standings</p>
  <p class='text'>Every week, I plan to share a league history stat here. If you have any suggestions for future stats, feel free to let me know. This week's stat is the Average Final Standings of each owner over the years. Here are the results:</p>
  <table class='tableBody' style='margin: auto;'>
    <tr class='tableHead'><td colspan='3'>Average Finish</td></tr>
    <tr class='tableSubHead'>
      <td>Team Owner</td><td>Years Played</td><td>Average Place</td>
    </tr>
    <tr class='light'>
      <td class='nocenter'>Team #1</td><td>2007-2012</td><td>5.04</td>
    </tr>
    <!-- more rows here -->
  </table>

  <p class='text'>Coming Up Next Week: Average Points Per Week</p>
</div>
</body>

Here is the corresponding CSS:

body {
  background-image: url(http://g.espncdn.com/s/ffllm/13/images/shell/bgHead.jpg);
  background-repeat: no-repeat;
  padding: 0px;
  padding-top: 10px;
  font-size: 14px;
  margin: 0px;
  color: #000;
  font-family: verdana, arial, helvetica, sans-serif;
}

.tableBody {
  font-size: 1em;
  color: #000;
  text-decoration: none;
  text-align: center;
  width:50%;
}

.nocenter {
  text-align: left;
}

.tableBody td {
  padding: 5px;
}

.tableHead {
  font-size: 1.2em;
  color: #fff;
  padding: 5px;
  background-color: #6dbb75;
  text-align: center;
}

.tableSubHead {
  font-size: 1.1em;
  color: #000;
  padding: 5px;
  background-color: #6dbb75;
  text-align: center;
}

.light {
  background-color: #f8f8f2;
}

.dark {
  background-color: #f2f2e8;
}

Everything displays perfectly on my laptop browser, but when viewing it on my phone, the table appears tiny! Even with a three times larger font size, it's still small. Can anyone explain why this happens and suggest a solution?

This issue occurs on a Samsung Galaxy S2 using the latest Firefox browser (v24).

Update: I've experimented with various units like px, em, %, etc., but nothing seems to work. While I can implement a workaround by detecting a mobile browser and adjusting the layout, I'm curious about the discrepancy in text rendering despite specifying the same font.

Answer №1

To ensure compatibility, it is important to create code that works well with both devices and browsers. Detecting the device and browser can help in this process - you can find more information here. This resource offers insights on creating resolution-specific stylesheets. Additionally, check out this helpful link.

Using em units for defining font size is recommended.

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

Implement a slideshow feature that automatically changes a CSS attribute when preview images are shown

(Apologies for the perplexing title) My intention was to create a slideshow gallery, and I stumbled upon an example here: https://www.w3schools.com/howto/howto_js_slideshow_gallery.asp In this setup, you'll notice previews of images in a small bar b ...

Incorporating external CSS stylesheets into a custom LESS framework

Is there a reliable method for integrating a third-party CSS file obtained from an external source into my own LESS compile structure without making many changes to it? I anticipate that the external CSS file may be updated periodically, so I would prefer ...

Implement a sequence of animations within a div using jQuery

My goal is to create an animation effect for each div element within a row when the user scrolls down to that specific point on the page. The layout consists of three <div> elements in the same row. The structure of the HTML code is as shown below: ...

Utilize CSS properties to pass as arguments to a JavaScript function

Is there a way for me to make my CSS animation functions more efficient? I have similar functions for different properties like height, width, and left. Can I modify the function below to accept a CSS property argument instead of hardcoding height? Window ...

Is it possible to implement a hover animation within another hover animation in WordPress?

Trying to incorporate two hover animations for the images in my photo galleries. When hovering over an image, I want a text to appear in a black overlay, and then when hovering over that text, it should become underlined. Looking for something similar to ...

Is there a way to incorporate jQuery into SharePoint 2010?

I am encountering an issue with linking my HTML page to our organization's SharePoint 2010 portal. All necessary files (CSS, images, jQuery) are stored in the same document library. While the CSS is functioning properly, I am facing challenges with ge ...

Bug with the animation of height in Jquery

Unfortunately, I can't share my entire source code here because it's quite lengthy. However, maybe someone can provide some insight into a common issue that may be happening elsewhere. The problem I'm facing is with a DIV element that has r ...

The <pre> tag is not adjusting the column width properly within the Bootstrap framework

I have utilized Bootstrap CSS to style my webpage. Interestingly, when I incorporate the <pre>...</pre> tag within the class="col", it does not adjust the width of the column as expected, and instead enlarges the entire column's ...

Tips for adjusting the angle in SVG shapes

I have designed an svg shape, but I'm struggling to get the slope to start from the middle. Can someone please provide assistance? <svg xmlns="http://www.w3.org/2000/svg" fill="none"> <g filter="url(#filter0_b_1_2556)"&g ...

Scaling down the screen for a smaller display

Having trouble achieving a specific effect and could use some assistance. My goal is to create an action where, upon clicking on the nav element (for simplicity, I've set it to be triggered by clicking anywhere on the body), the following should occur ...

What is the method to adjust the font size for section, subsection, and other sections in Doxygen?

I am looking to customize the font size of \section and \subsection in doxygen's html output. Additionally, I want to include numbering for the sections and sub(sub)sections in the format: 1 Section1 1.1 Subsection1.1 1.1.1 Subsubsection ...

Tips for increasing the number of pixels in the current position of an element?

I need to shift an image to the right by adding pixels to its current left position. The challenge arises when the image, positioned absolutely, goes back to its nearest relative parent (the container) and creates a strange visual effect. Within my flex c ...

Struggling to position search form to the right side of an <li> element

I'm having trouble aligning my search bar to the right side of the navigation menu items. HTML: <body> <div id="navbox"> <nav id="nav"> <ul id="nav"> <li><a href="#">Home< ...

Is there a way to attach a CSS class to a BoundField in order to locate it using jQuery?

I need to assign a specific class name to certain BoundFields within the GridView control. This way, after the GridView has been populated with data and displayed, I would like to have something similar to the following: <td class="Tag1">Some data c ...

What is the best way to conceal the bottom portion of an image?

My image in the header overlaps with the next section's features (image-phone). https://i.sstatic.net/4g0SO.jpg I've tried changing the position and z-index types. If I crop the image, it's not ideal and difficult to fix ;) How can I stru ...

Is it possible to incorporate a label within a dropdown menu (<select>)?

How can I add a label inside a select box using Bootstrap? Here is an example: Before selecting an option After selecting an option, the label should appear in a small size like this: After selecting an option : <div class="form-group"> & ...

Is the code generated by Webflow.com functional and practical?

Recently, I have discovered the wonders of www.webflow.com for creating an admin layout. It excels in generating a flexbox layout based on my PSD design without requiring me to manually code with Gulp. My plan is to further simplify the process by breaki ...

Manipulating contextual selectors

Have you ever tried reverting or overriding attributes from contextual selectors? .card { padding-top: 20px; ... } .card .card-header { padding: 0 20px; } .card .card-header.news { padding-top: 0px; } Do you think it's possible to elimina ...

Swiper.IO pagination indicators not displaying

Why is the pagination not showing up on the image carousel I created with Swiper? Despite being in the DOM, it has a height of 0 and manual changes have no effect. Any suggestions? import Swiper from '../../vendor/swiper.min.js'; export default ...

Set a unique class for several elements depending on a given condition

Is there a way to assign a color class based on the element's value without looping through all elements? Check out my jsfiddle HTML <div> <ul> <li class="MyScore">90</li> <li class="MyScore"> ...