Using Tailwind CSS to change the style of a parent div in response to the selected state of a radio button
P粉718165540
P粉718165540 2023-08-15 23:49:52
0
1
391
<p>I have a table with multiple columns and a radio button per row. I need to change the background color of the entire row when I select a specific button. Can this be achieved? </p> <pre class="brush:php;toolbar:false;"><tr class="flex items-center p-4 space-x-4 border hover:bg-indigo-50"> <input type="radio" name="user" id="{{ user.id }}"> <label for="{{ user.id }}">{{ user.email }}</label> <div>{{ user.name }}</div> </tr></pre> <p>In Tailwind, you can use the "peer" class to style adjacent blocks. But I need to style the parent block (when the <input> is selected, the background color of the parent block should change). </p>
P粉718165540
P粉718165540

reply all(1)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!