Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6870457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:41:09+00:00 2026-05-27T03:41:09+00:00

My problem is so simple, that I cannot believe that there is no HTML/CSS

  • 0

My problem is so simple, that I cannot believe that there is no HTML/CSS based solution for iOS 4 and above.

I have grid of images, each subtitled with a single line of gray text. The text is bordered by lines at the top and at the bottom.

When the user taps down on the element (the image or the subtitle) the text and the lines should change the color to white and resets the color, when he lifts the finger again. I would even be better, if an additional line would appear at the top of the image. The whole element is encapsulated in a div.

I already tried to use the CSS properties -webkit-tap-highlight-color, -webkit-active-link and :hover, :active on the div or various subelements, without any success so far.

As suggested I tried this document

<!DOCTYPE HTML>
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="highlight.css" />
    <style type="text/css"></style>
    <script type="text/javascript">
      div = document.getElementById('element');
      div.ontouchstart = function(){this.style.backgroundColor = '#fff';} // on tapping
      div.ontouchend = function(){this.style.backgroundColor = '#000';} // on releasing
    </script>
   <title></title>
  </head>
  <body>
    <div id="element">
      <p>Dies ist noch ein Test.</p>
      <p>Wenn man auf <a href="#">diesen etwas laengeren Link </a> tappt, sollte was     passieren.</p>
    </div>
  </body> 
</html>

with this style sheet

#element {
    width:200px;
    height:200px;
    border:solid;
    border-color:blue;
    -webkit-user-select:none;
}

But this also seems not to work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:41:10+00:00Added an answer on May 27, 2026 at 3:41 am
    div = document.getElementById('#DIV');
    div.onmousedown = function(){this.style.backgroundColor = ###;} // on tapping
    div.onmouseup = function(){this.style.backgroundColor = ###;} // on releasing
    

    Since you’re not into JS – here’s the complete script for you:

    <script>
    div = document.getElementById('elem');
    div.onmousedown = function(){this.style.backgroundColor = '#f00';} // on tapping
    div.onmouseup = function(){this.style.backgroundColor = '#000';} // on releasing
    </script>
    

    Put it after your element’s tag.

    Here something even better:

    <script>
    function changeClr( id , clr ){
        document.getElementById( id ).backgroundColor = clr;
    }
    </script>
    

    Put the code above in the <head> element.
    All left to do is to add to your element theese atts:

    onmousedown='changeClr( "id" , "#f00" );' onmouseup='changeClr( "id" , "#000" );'
    

    e.g. <div id='element' onmousedown='changeClr( "element" , "#f00" );' onmouseup='changeClr( "element" , "#000" );'></div>

    That code allows you to change color of any element by adding theese atts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple problem that I cannot seem to find a solution to.
I have a simple problem that i cannot solve. I have a dictionary: aa
I have a very simple problem and a solution that will work, but I'm
My problem is simple: I have a long list of elements that I want
This seems like a simple problem: I have a WF4 activity that guides the
i have very simple problem. I need to create model, that represent element of
I have a pretty simple problem. Basically I have an array called $list that
The problem itself is simple, but I can't figure out a solution that does
I have a quite simple scenario that I cannot get to work correctly. I
Simple problem that I can't figure out... How can I print a '%' character

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.