Chrome on Android has larger text size displayed on websites

I am currently developing a website for a client and encountering some display issues specifically on Chrome using an Android phone. The text in a regular div unexpectedly enlarges to 42px on my Samsung Galaxy S3 device.

Interestingly, there are no compatibility problems when I view the site on Firefox on the same mobile phone, nor do I face any issues when accessing it on a desktop computer.

The CSS code causing this anomaly is as follows:

#content.is-front .post:first-child .post-title-excerpt {
   left: 2%;
   float: left;
   z-index: 99;
   bottom: 2%;
   border: none;
   width: 92%;
   padding: 2%;
   overflow: hidden; /* not present on the live site. It could prevent text from overflowing the box but won't affect the enlarged font size. */
   color: #ffffff;
   max-height: 133px;
   position: absolute;
   font-size: 14px !important;
   background: rgba(0, 0, 0, .7);
}

As for the HTML structure, it resembles the following snippet:

<div id="post-138" class="post-138 post type-post status-publish format-standard hentry category-torsten tag-featured">
    <div class="post-header">
       <a href="http://copenhero.dk/torsdagsbar-guide/">
       <img width="940" height="390" src="http://copenhero.dk/wp-content/uploads/2014/03/Torsdagsbar-forside-featured2.jpg" class="attachment-front-featured-thumb wp-post-image" alt="Torsdagsbar forside featured2">              </a>
<div class="post-title-excerpt">
    <div class="post-category"><a href="http://copenhero.dk/kategori/torsten/">Tørsten</a></div>
    <div class="post-title"><a href="http://copenhero.dk/torsdagsbar-guide/">Guide: Torsdagsbarer i København</a></div>
    <div class="post-excerpt"><p>Øl, drinks og shots har som bekendt ikke kun den ønskede effekt i weekenden. Torsdag kan være en perfekt gå-ud dag med gode tilbud, flere siddepladser og knapt så meget pres på fadølshanerne rundt omkring i København. Copenhero har været på field-research, og er gået videnskabeligt og alkoholisk til værks for at finde lidt for […]</p>
</div>
<a class="post-permalink" href="http://copenhero.dk/torsdagsbar-guide/">Læs mere</a>
    </div>
  </div>
</div>

Answer №1

The reason for this issue is due to the Android browser automatically resizing non-responsive content. To solve this problem, simply use em units instead of pixels. Keep in mind that 1em is typically equal to 16px.

#content.is-front .post:first-child .post-title-excerpt {
    ...
    font-size: 0.85em !important;
    ...
}

Answer №3

Experiment with using em instead of px for setting the font-size. I've found that px values don't always work well on mobile devices. It could also be helpful to organize your style rules using media queries. And when debugging, assigning an id to the troublesome element can make the process easier.

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

Selenium aids the driver in locating elements

Currently working on Java programming. Here is a snippet of web code I am dealing with: <button class="btn-link" data-sugg-sources="full_name" data-sugg-technik="make_initial_and_name">NG1ulkan</button> When I right-click and copy the CSS sel ...

Divide text to reduce its width within the confines of a specific height on a div element

I've spent the past week scouring various forums, including stackoverflow, but I haven't been able to find a solution. In my responsive website, I'm using CSS flexbox to display dynamic menu items. Sometimes the text can be quite long, and ...

Displaying the parsed values from a JSON file and populating a list with the help of a one

package com.pack.indium.mismobile.activities; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.ActionBar; import android.app.Activity; import android.app.ProgressDialog; import android.content.Inten ...

Can JavaScript be used to continuously monitor a window variable object in real-time?

Is there a way to dynamically control a variable in JavaScript? I'm currently working on a code that needs to display a button when it reaches the last signature of an automatic request process. The code for activating/deactivating the button is show ...

New to CSS Media Queries? Discover the Correct Way to Define Element Height!

Sorry for the oversized images! I'm diving into media queries for the first time. When I adjust my browser window to 320px, here's how my site displays: This is what I want it to look like on mobile phones. However, when I view it on my iPhone, ...

Creating Responsive Headers Using CSS for Mobile Devices

I'm looking to make my header font size of 60px more responsive for mobile devices so that the text doesn't get cut off. Any suggestions on how to achieve this? Thank you! Here's the code snippet: h1 { font-size: 4.286em; /* 60px */ margi ...

Struggling to retrieve a JSON object from an Express and Node application, only receiving an empty result

Can anyone assist me? I'm having trouble with the res.json() function in my code. It seems to work after the first request, but not after the second. Right now, my application is quite simple - it scrapes user data from social media platforms like Twi ...

Deciphering Keycodes in Chrome for Mac OS is a must-know skill for smooth

Is there a way to prevent the '-' key from being pressed on an input field? Initially, I tried using the following solution: if(e.keycode == 189 || e.which == 189 ){ return false; } However, it turns out that both the '-' and &apos ...

Is it possible to conceal any spans that are in close proximity to the cursor when hovered over?

Currently, I am working on a project that involves multiple spans placed side by side, with each span containing a letter of the text. My aim is to create a functionality where hovering over one of these spans will not only hide that particular span but al ...

Applying media queries to a <div> instead of the entire viewport can be a useful technique, especially when used in conjunction with

I am looking to create a dynamic layout where different content such as tables and masks can be displayed in multiple areas or columns on a website. Typically, the left column will contain a list, the middle column details of an entry, and the right column ...

Displaying Firebase information in ListView

I'm facing an issue with displaying stored data in a ListView. Despite not encountering any errors, the data I've stored is not showing up as expected. Within my application, teachers register and select the subjects they wish to teach, which ar ...

Title overlaid filterable portfolio showcase

I am currently working on developing a filterable portfolio that features a colored overlay showcasing the project title similar to this example: Example of Overlay: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_image_overlay_fade However ...

Using PHP to manipulate MySQL databases with HTML tags

I am encountering an issue with strings retrieved from my database. These strings contain various HTML tags within them. For instance: "<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys ...

Optimizing HTML5 metatags and styles for a mobile application

As a C++ developer who has recently delved into using HTML5 for my mobile applications, I am in need of guidance when it comes to fine-tuning my meta tags. While I do have some knowledge in web programming, there are still gaps in my understanding. I am s ...

disable border-collapse styling in ASP.NET DataList

Currently, I am new to the world of ASP.NET and I am facing a challenge in styling a DataList. Lately, I have developed a fondness for rounded corners on borders, and I am attempting to incorporate this effect into all my pages by implementing it across al ...

Positioning a div in the center horizontally may result in content with a large explicit width being

I am in search of a solution to horizontally center content on a webpage, regardless of whether or not it has a defined width. After referencing a Stack Overflow question on centering a div block without the width, I found a great method that works well w ...

Are there any other options available in JavaScript to replace the .unload() function?

I have a click event attached to multiple buttons on my page, each loading a different .php file into the same div. The issue arises when the time to load increases after several clicks. $('#start').click(function() { $('#mainbody&apos ...

When you include ng-href in a button using AngularJS, it causes a shift in the alignment of the text within the button

Recently, I've been delving into Angularjs with angular-material and encountered a slight issue with ng-href. I created a Toolbar at the top of my webpage, but the moment I include the "ng-href" attribute to a button, the text inside the Button loses ...

Custom TabLayout in Android

I am looking to create a tab layout view that resembles the design shown in this image: https://i.sstatic.net/QtgoP.png Below is the code I have implemented for the tab layout: public class MainActivity extends AppCompatActivity { TabLayout tabLayo ...

Manipulating attribute values using Jquery

Currently, I am attempting to switch the src value of an iframe when a link is clicked by replacing it with the href from that link. By preventing the default action upon clicking the button, I can successfully update the src value with the url provided. H ...