[CSS] Conditionally Assign Style to a Parent Element with Focus-Within Pseudo-class
Use the focus-within pseudo-class to conditionally assign styling to a parent element when its child receives focus.
HTML:
import "./styles.css"; document.getElementById("app").innerHTML = `
<ul id="red">
<li>
<input value="Red">
</li>
</ul>
`;
CSS:
#red:focus-within {
background-color: red;
}
[CSS] Conditionally Assign Style to a Parent Element with Focus-Within Pseudo-class的更多相关文章
- CSS(Cascading Style Sheet,叠层样式表),作用是美化HTML网页。
CSS(Cascading Style Sheet,叠层样式表),作用是美化HTML网页. /*注释区域*/ 此为注释语法 一.样式表 (一)样式表的分类 1.内联样式表 和HTML联合显示,控 ...
- CSS(Cascading Style Sheet)简述
CSS(Cascading Style Sheet)简述 什么是CSS? css是指层叠样式表 css定义了如何显示HTML元素 css的诞生是为了解决内容与表现分离的问题,可以极大地提高工作效率 样 ...
- CSS层叠样式表(Cascading Style sheets)
CSS层叠样式表(Cascading Style sheets) --------- ---------------- ----------- --------------- ----------- ...
- switchable css dark theme in js & html custom element
switchable css dark theme in js & html custom element dark theme / dark mode https://codepen.io/ ...
- 获取css样式,style、getComputedStyle及currentStyle的区别
样式表有三种: 内嵌样式:<div id="box" style="color:red">box</div>,style写在html中的 ...
- FCC---Use the CSS Transform scale Property to Scale an Element on Hover
The transform property has a variety of functions that let you scale, move, rotate, skew, etc., your ...
- css width="100" style ="width:100px" 区别
1. width="100"是正确的,而 width="100px"是错误的, style = "width:100px"是正确的 2. s ...
- 【css】主要的块状元素(block element)和内联元素(inline element行内元素)
内联元素:只在行内发生作用,设置宽高不起作用,不会影响文字内容,使其换行等.竖直方向和间距也不起作用 display可以强制转换行内元素和块状元素,还可以取消显示none 块元素(bloc ...
- FCC---Use the CSS Transform Property skewX to Skew an Element Along the X-Axis
The next function of the transform property is skewX(), which skews the selected element along its X ...
随机推荐
- 机器学习SVD笔记
机器学习中SVD总结 矩阵分解的方法 特征值分解. PCA(Principal Component Analysis)分解,作用:降维.压缩. SVD(Singular Value Decomposi ...
- Linux 进程地址空间及原理
1.程序地址空间 首先,我们先看学c/c++时候学到的程序内存布局: 准确地说,程序地址空间其实就是进程的地址空间,实际就是pcb中的mm_struct. 接下来,我们用fork()演示一下 ...
- springboot项目实用代码整理
// 判断JSONOBJECT是否为空 CommonUtils.checkJSONObjectIsEmpty(storeInfo) // 判断字符串是否为空," "也为空 Stri ...
- VBA for循环
for循环是一种重复控制结构,它允许开发人员有效地编写需要执行特定次数的循环. 语法 以下是VBA中for循环的语法. For counter = start To end [Step stepcou ...
- js的变量类型
参考网址:https://www.cnblogs.com/focusxxxxy/p/6390536.html (讲的蛮好得,图文并茂,我下面只是总结下) 一:ECMAScirpt 变量的两种数据类型 ...
- 这个一个对ES6多个异步处理的并发继发思想的总结和理解
1.首先我们需要理解的是js中for循环.forEach循环.map循环的一些差异性,直接说了为后面说到的提供一些依据 1.1 for循环最基本,也是最容易理解的. 1.2 forEach和map用法 ...
- springboot 常见的启动器
<!--pringBoot提供了一个名为spring-boot-starter-parent的工程, 里面已经对各种常用依赖(并非全部)的版本进行了管理 我们的项目需要以这个项目为父工程,这样我 ...
- cmake简单用法
CMake是一个跨平台的编译工具,类似于automake 安装 # cd cmake-2.8.10.2 # ./bootstrap # make # make install project proj ...
- MongoDB官方推荐的GUI工具-Compass的使用
探索和操作MongoDB数据的最简单方法 用于MongoDB的GUI.可视化地查看数据.以秒为单位运行临时查询.使用完整的CRUD功能与数据交互.查看和优化查询性能.可在Linux.Mac或Windo ...
- Vue 案例 列表动画实例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...