Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use the <code>:active</code> pseudo-class in your css, then add <code>ontouchstart=""</code> and <code>onmouseover=""</code> to the body tag.</p> <p>The following code is excerpted from my site, in which I have buttons that get smaller and glow white when hovered(on pcs) or held down(on touch devices)</p> <pre><code>&lt;style&gt; .boxbutton:active{ -webkit-transform:scale(0.9); -moz-transform:scale(0.9); -ms-transform:scale(0.9); -o-transform:scale(0.9); transform:scale(0.9); -webkit-box-shadow:0px 0px 20px #FFF; -moz-box-shadow:0px 0px 20px #FFF; -o-box-shadow:0px 0px 20px #FFF; box-shadow:0px 0px 20px #FFF; } &lt;/style&gt; &lt;body ontouchstart=""&gt; &lt;a href="#teamdiv"&gt; &lt;div class="boxbutton" id="teambb"&gt; &lt;h5&gt;Team&lt;/h5&gt; &lt;/div&gt; &lt;/a&gt; &lt;/body&gt; </code></pre> <p><em>The following edits are no longer relevant because I have deleted the original, incorrect instructions, but if you were here before these may still be helpful</em></p> <p><strong>EDIT:</strong> I have discovered it works more reliable if, rather than putting <code>ontouchstart=""</code> in each link, put it in the <code>&lt;body&gt;</code> tag. So your body tag should look like this<code>&lt;body ontouchstart=""&gt;</code> and your links look like this </p> <pre><code>&lt;a href="#teamdiv"&gt; &lt;div class="boxbutton" id="teambb"&gt; &lt;h5&gt;Team&lt;/h5&gt; &lt;/div&gt;&lt;/a&gt; </code></pre> <p><strong>EDIT 2:</strong> I have figured out that, rather than copying your CSS and use screen size queries for desktop, just add `onmouseover="" to the body tag also, so the :active pseudo class will be called by the mouse on the desktop AND by touches on mobile. You can just ignore the rambling about media queries if you do this.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload