sticky effects on touchscreens when hovered or focused upon

Is there a solution to the issue described in the following quote?

Bootstrap: link

:hover functionality is not supported on most touch devices, but iOS tries to replicate it by creating persistent hover styles that remain after tapping an element. These styles are only removed when users tap elsewhere.

Here is the code snippet provided:

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>

<div class="container-fluid p-3">
  <button class="btn btn-outline-primary">Click here</button>
</div>

On an iPad, when the button is tapped, the :active state remains sticky and does not change. Is there a CSS solution to this problem?

Answer №1

Learn how to make elements active using CSS Feel free to ask any questions :)

.active:active {
  color: red;
}
.active:hover {
  color: red;
}
.focus:focus {
  color: red;
}
:target {
  color: red;
}
<div class="container-fluid p-3">
<button class='btn btn-outline-primary active'>Active</button>
<button class='focus'>Focus</button>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>



  <button class="btn btn-outline-primary">Click here</button>
</div>

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

Steps for registering a function on $rootScope when angularjs is ready

In order to make a method accessible throughout angularjs, I am looking to register it with 2 arguments (the resource id and the delete callback) using the resource provider to handle the deletion process. To properly register this method, I need angularj ...

The elements within the side navigation menu are not displaying correctly within the app component's HTML file

In my Models.ts file, I created a code that requires me to call the headers in side-nav.component.ts to app.component.html. However, when I try to call app.index.html by typing <side-nav><side-nav>, the component seems to be not specific. mode ...

Deleting an added element upon closing the dialog box

Utilizing JQuery and Ajax, I successfully update my database. Following each update, a png icon is displayed briefly for 1 second. Specifically, the update form is contained within a JQuery dialog box. However, upon closing the dialog box after an update, ...

Incorporating a classList.toggle into a snippet of code

button, p, h1, h2, h3, h4, h5, a{ /* Define specific elements to use "fantasy" font */ font-family: Tahoma; } #main_body{ margin: 0px auto; background-color: #dedede; } #top_body{ /* Remove margin for simplicity */ } #t ...

Using AJAX in a knockoutjs Form Demonstration

I need help creating a basic form using Knockoutjs to send user information via AJAX. Is there an example available that includes three fields (firstname, lastname, postal-code)? The form should either populate with values from the server if available or d ...

Ways to eliminate HTML tags from the output while preserving the formatting

I recently encountered an issue working with a MySQL database. To prevent SQL injections, I utilized: $entities_correction = htmlspecialchars($Query, ENT_COMPAT, 'UTF-8'); However, when attempting to display the data to the user, it appeared as ...

What is the process for using AJAX and PHP to upload an image file?

I'm facing an issue where I want to insert an uploaded image into a database with user details for a profile picture. The output I receive currently shows {"current_field":null,"field_count":null,"lengths":null,"num_rows":null,"type":null}. How can th ...

Using R Markdown and Hugo to Style Blog Titles

I am currently utilizing Hugo and Blogdown to craft a blog following the guidelines outlined here. The title of my blog is specified at the beginning of each post, resembling the example below: --- title: One Two Three author: First Last date: '2019- ...

What is the best way to incorporate a custom modal created with HTML/CSS into my Bootstrap website?

I am facing an issue with the modal implementation on my bootstrap website. The modal is supposed to open when a user clicks a button. Strangely, it was working perfectly fine on another HTML/CSS file, but once I added it to this Bootstrap file, it stopped ...

Problem with displaying JSF Bootstrap Glyphicons

I recently encountered a problem in my web app where my Glyphicons in Bootstrap suddenly stopped working, appearing as empty squares for no apparent reason. Even after ensuring that the font files were intact and replacing them with fresh ones from versi ...

SweetAlert.js does not function properly within a custom AngularJS directive

When creating a list to display in a modal, I utilized directives for the modal implementation. (I actually didn't write these directives myself) Within the list, each item features two buttons - one for editing the name and the other for deleting t ...

Get the value of the button that has been clicked

I have a query regarding building a website that can be started via PowerShell. The PowerShell HTML code I am using is: $proxys = "" foreach ($email in $ADObj.proxyAddresses){ $proxys += "<button id='$email' name='alias&apo ...

Experiencing problems with web page layout when using bootstrap on IE8?

Here is a code snippet that functions correctly in IE9 and later versions, but encounters issues in IE8: <div class="col-lg-5 col-md-5 col-sm-6 col-xs-6" id="div1"> <div class="panel panel-default" style="" id="panel1"> ...

polygon with five or more sides

Can divs be created with shapes such as five or six corners? I am looking to create clickable zones on a map and any alternative methods would be greatly appreciated. ...

Retrieving an auto-generated number on the account dashboard (login portal)

I'm currently working on a login section for my website. I have set up a table with UserID (auto-increment), email, password, and other necessary fields. Despite my efforts, I am facing issues with logging in users and displaying their UserID on the a ...

Creating a fieldset and form in HTML code involves using

I encountered a strange issue recently. I had set up a form in HTML to send data to my PHP script, and everything was functioning correctly. However, the design looked a bit messy without margins, so I decided to make some CSS adjustments. After applying s ...

Creating a shortcode that displays a single user avatar in WordPress using a custom function plugin

I'm trying to see if I can integrate this code snippet into a WordPress shortcode located in functions.php <p id="<?php echo esc_attr( ( 'add-new-user' == $user ) ? 'wpua-upload-button' : 'wpua-upload-button-existin ...

Having trouble sending a file with a form using JQuery AJAX?

Looking for assistance with an AJAX function utilizing JQuery: var formData = $('#FonykerEditForm').serialize(); $.ajax ({ type: 'POST', url: '<?php echo $html->url('/fonykers/edit',true); ?>', ...

Use jQuery to dynamically alter color based on conditional statements

What could be causing the background color not to change to green? var id; id = setInterval(changeColor, 1000); function changeColor(){ var elem= $("#target"); var color = elem.css('background-color'); if (color == &apos ...

Creating an interactive time selection tool with two dropdown lists that are dependent on each other using HTML and JavaScript

Hi everyone, I am new to JavaScript. I am currently working on creating two dropdown lists, one for 'Start Time' and another for 'End Time'. These dropdown lists will display hours in a 24-hour format with intervals of 30 minutes. In t ...