This webpage contains multiple instances of the <p>
element. I want to change the background color of the paragraph that a mobile user touches. When another paragraph is touched, the previously selected paragraph should revert back to its original "default white" background color.
I have tried several selectors with no success. Is there a way to achieve this using CSS? Thank you for your help.
edit
I have 2-3 lines of data that need to be shown to the user. I decided to use paragraphs for each group of 2-3 lines so I can format and display the data like a vertical list. Therefore, I want to be able to select an item from the list and perform other actions related to the selected item.
.selectable:focus {
background-color: lightgray;
}
<template name="myName">
<p class="selectable"><b>{{value.[0]}}</b><br/>{{value.[1]}}<br/>{{value.[2]}}</p>
</template>