Touching a link within an absolute DIV in CSS on mobile devices is not responsive

When I try to click on links inside a div with the position:absolute style, they don't seem to work on my Android mobile device. However, they work perfectly on both Chrome and even IE8 on my desktop.

Removing the style makes the links functional. The class msg-inner is only used for jQuery, which applies a scrollTop function with no additional styling. I have tried various solutions like using z-index or position:relative on the inner div, but none of them seem to resolve the issue. I even attempted using position:fixed on the msg_container, but the problem persists. The inner div scrolls properly and everything looks correct, but the links remain inaccessible. Interestingly, some links work sporadically while others do not. I removed all styling and placed plain links inside to rule out any formatting issues, but the problem persists.

<div id="msg_container" class="absolute" style="overflow-y:auto;width:100%;height:75%">
    <div class="msg_inner">

.... stuff in here with links
</div><!--msg inner-->
    </div><!--msg_container-->

CSS

.absolute {
position: absolute;
}

Answer №1

Avoid setting the position of absolute for your #msg_container element; instead use it for the .msg_inner element. Here's an updated code snippet for you to try:

HTML

<div class="msg_container">
    <div class="msg_inner">
        .... content goes here including links
    </div><!--msg_inner-->
</div><!--msg_container-->

CSS

.msg_container {
    position: relative;
    width: 400px;
    height: 400px;
}

.msg_inner {
    position: absolute;
    top: 0px;
    left: 0px;
}

Additionally, I've changed msg_container to a class instead of an ID to follow best practices and avoid having multiple IDs with the same name. This way, if you have multiple msg_container elements, using a class will prevent any conflicts.

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

Change the Background of Your Body?

Here's the deal. I'm looking to create a cool effect where the background of the body slowly fades out and changes periodically in a loop using CSS and jQuery. Any suggestions on how I can make this happen? Appreciate your help! ...

Retrieve data quickly and navigate directly to specified div element on page

I am facing an issue with scrolling on my website. While it currently works fine, I would like to make the scrolling instant without any animation. I want the page to refresh and remain in the same position as before, without automatically scrolling to a s ...

Is there a way to verify if an AJAX request calls HTML content?

Here is the HTML code for a mosaic of images. <div id="container"> <img id="1" /> ... <img id="20" /> </div> This script creates a mosaic layout from the images on the page after it has loaded or been resized. <script& ...

"Enhance Your Website Navigation with HTML5 and CSS - Creating a Wide

I've spent a full day trying to solve this issue, but unfortunately, I haven't been able to achieve any results. My goal is to create a menu with collapsible links that expand horizontally when hovering over the parent <li>. Essentially, it ...

Ways to create a fading effect for a div container

As I delve into learning Rails, I've been immersed in a Rails web app where there is an enticing "Order" button that triggers a response saying: "Thank you for ordering". This message is displayed using the flash action. To enhance user experience, my ...

PHP dropdown menu is a dynamic feature that provides users

Can anyone help me identify the issue with this code? I am struggling to display the sub menu... I suspect the problem lies in the section where I retrieve the sub menu from the database. However, upon inspection, everything seems correct... It's po ...

Is it possible to have an Iframe that contains content but no src attribute?

During the process of troubleshooting jQuery code on their website (using the Chrome Developer Toolbar), I came across an interesting observation. I found that their examples were embedded within an Iframe: Here, for instance, there is a sample displayed ...

Avoid button wrapping in Bootstrap 4 navbar

Is there a way to make the search bar shrink on mobile view while keeping everything in line? Currently, the button is wrapping underneath the search bar. Check out the solution on JSFiddle body { margin: 10px; } .navbar-container { display: fle ...

Having trouble displaying background images on GitHub pages?

I have encountered an issue with images not displaying correctly on GitHub Pages, despite trying various solutions suggested in previous posts. Strangely, the page functions perfectly on my local machine and on Netlify, but on GitHub Pages all the images a ...

Learning the basics of JavaScript: Displaying the last number in an array and restarting a function

Hey there, I'm diving into the world of JavaScript and have set myself a challenge to create a simple bingo number machine. Check out my CodePen project here. I've successfully generated an array of 20 numbers, shuffled them, and added a marker t ...

Height set at 100% but not extending to the entire parent element

I've applied min-height: 100vh; to the body, and then height: 100% to the main element. However, the height of the main does not extend fully to its parent container. Could someone please help me understand why this is happening? Thank you. I'v ...

Solution to trigger CSS :hover to refresh following a transition (such as expanding a menu)

While there are existing discussions on this topic, I am presenting my query for two specific reasons: It introduces a potential alternative solution The demo code could be helpful to individuals looking to emulate a menu Following a CSS transition, the ...

The initial character of the input must always be a letter

I need assistance with an input element that requires 5 characters, with the first character being a letter: <input mdInput #acronyme placeholder="Company" type="text" maxlength="5" minlength="5" required [value]="acronyme.value.toUpperCase()"> Th ...

Tips for displaying the CSS3 background image on your website

My website is not displaying the background-image with the URL img/hero.jpg. I attempted using ../img/hero.jpg but still no success. Are there any solutions to this issue? I also experimented with a PDF image, but it did not work either. ...

Centering the header image on the screen creates a visually appealing focal point

Looking to design a header image for my website that always stays centered. I want the image to stand out and remain in the middle even when the browser window is resized. I found an example on this website that achieves this effortlessly. ...

Dropdown menu will appear when you click on one of the menu items

Can someone help me create a dropdown menu using a JavaScript function that toggles on click? I've attempted to do so with the following code, but it's not working as expected. Could you please point out where I might be going wrong? I'm loo ...

Tips for submitting a form using alternative methods of action

Currently, I am facing a challenge in retrieving information from a database using submit buttons with the same name. I assign a value to these buttons, which corresponds to the id of the row, enabling me to perform different actions. However, I am unsure ...

unable to get highcharts to redraw and reflow properly

I am currently working on creating a dynamic page that can display between 1-4 graphs. These graphs need to be able to resize when added or removed from the page. However, I have encountered a major issue with resizing the graphs after resizing the contain ...

How can I make JavaScript skip over a specific portion of my HTML code?

I have a script running on all pages of my website. I would like it to continue running on the specific page, but ignore a certain section. For example: <p>process with javascript</p> <p>skip, instruct javascript function to ignore</ ...

Adding a file filter in Kendo v2016 is a simple process that can greatly enhance

I'm exploring how to implement a file filter in Kendo.Mvc.UI.FileUpload. I've come across some examples online that utilize a method called 'select', but it seems that the current version of Kendo I'm using doesn't have this m ...