【发布时间】:2021-12-23 18:37:57
【问题描述】:
我试图在单击主按钮时更改按钮的颜色,一种颜色正在改变为什么其他按钮颜色没有改变,是因为它在主<div> 之外我如何在不删除任何 div 的情况下实现它。
button.one:focus~div.two {
background-color: rgba(185, 28, 28, 1);
}
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet" />
<div>
<button class="one bg-red-400 font-bold px-4 py-4 rounded-lg">MAIN BUTTON</button>
<div class="two bg-blue-400 font-bold px-4 py-4 rounded-lg">RED
</div>
</div>
<div class="two bg-blue-400 font-bold px-4 py-4 rounded-lg">MAKE THIS RED TOO</div>
【问题讨论】:
标签: html css tailwind-css