[CSS] The :empty Pseudo Selector Gotchas
The :empty
pseudo selector selects empty elements. We can use this to display useful messages instead of the empty content or hide the content completely. However, the :empty
pseudo selector comes with a couple of potentially confusing behaviors when it comes to which elements it considers empty.
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8" />
<style type="text/css">
p {
background: rgb(255, 211, 233);
margin-top: 10px;
margin-bottom: 0px;
padding: 10px;
}
// Be carefual that img is also considered as an empty element
*:empty {
display: none;
}
</style>
</head> <body>
<p></p>
<p>Some content</p>
<p></p>
<img
width="200px"
height="200px"
src="https://source.unsplash.com/user/erondu/daily"
/>
</body>
</html>
[CSS] The :empty Pseudo Selector Gotchas的更多相关文章
- 【CSS】Intermediate7:Pseudo Elements
1.selector:pseudo element{property:value;} 2.first-letter first-line CSS3:: 与pseudo class 区别 old br ...
- 【CSS】Intermediate2:Pseudo Classes
1.specify a state or relation to the selector selector:pseudo_class { property: value; } 2.Link 3.Dy ...
- [CSS] Target empty elements using the :empty pseudo-class
You can target an element that has no child elements by using the :empty pseudo-class. With browser ...
- [CSS] DOM Hierarchy Pseudo Classes :first-child :last-child :nth-child (demystified)
DOM hierarchy pseudo-classes allow you to style specific elements based on where they fall in the hi ...
- CSS元素选择器 element selector(type selector)
http://www.w3school.com.cn/css/css_selector_type.asp 元素选择器 最常见的 CSS 选择器是元素选择器.换句话说,文档的元素就是最基本的选择器. 如 ...
- 阅读jQuery源码的18个惊喜
注释:本文使用$.fn.method指代调用一系列选中的元素的方法.例如,$.fn.addClass,指代$('div').addClass(‘blue’) 或 $('a.active’).addCl ...
- Django项目:CRM(客户关系管理系统)--81--71PerfectCRM实现CRM项目首页
{#portal.html#} {## ————————46PerfectCRM实现登陆后页面才能访问————————#} {#{% extends 'king_admin/table_index.h ...
- Django项目:CRM(客户关系管理系统)--57--47PerfectCRM实现CRM客户报名流程02
图片另存为 16*16 名字修改为 bpm_logo.jpg /*! *bootstrap.js * * Bootstrap v3.3.7 (http://getbootstrap.co ...
- Django项目:CRM(客户关系管理系统)--47--38PerfectCRM实现全局账号登录注销02
图片另存为 16*16 名字修改为 global_logo.jpg /*! *bootstrap.js * * Bootstrap v3.3.7 (http://getbootstrap ...
随机推荐
- [转帖]MySQL的又一神器-锁,MySQL面试必备
MySQL的又一神器-锁,MySQL面试必备 https://segmentfault.com/a/1190000020762791 lock 低一级的是 latch 原文链接:blog.ouya ...
- JDBC预编译statement(preparedstatement)和statement的比较、execute与executeUpdate的区别
和 Statement一样,PreparedStatement也是用来执行sql语句的与创建Statement不同的是,需要根据sql语句创建PreparedStatement除此之外,还能够通过设置 ...
- STM32F103芯片SPI控制NRF24L012.4G无线模块交互通信实验
1.NRF24L01模块的资料百度搜索一下就有很多.这里我就不做介绍本文主要侧重于应用层面实验介绍与分享. 2.先看下原理图. 根据原理图:写出NRF24L01 C语言驱动文件如下: #includ ...
- python第三天---列表的魔法
# list 列表 # 中括号括起来,逗号分隔每个元素, # 列表中可以是数字字符串.列表等都可以放进去 list1 = [123, "book", "手动", ...
- Vue使用指南(二)
'''1.指令 ***** 文本指令 属性指令 方法(事件)指令 表单指令 条件指令 循环指令 2.组件 *** 局部组件 全局组件 父子组件间的交互''' 文件指令 <body> < ...
- Luogu5280 [ZJOI2019] 线段树 【线段树】
题目分析: 这题除了分类讨论就没啥了... 容易发现问题实际就是所有操作选和不选按顺序执行的所有答案和.考虑每个点在多少种情况下会有tag. 那么,考虑新插入一个[l,r],所有有交集的点都会被清空, ...
- 全栈项目|小书架|服务器开发-Koa全局路由实现
什么是路由 路由就是具体的访问路径,指向特定的功能模块.一个api接口是由ip(域名)+端口号+路径组成,例如 :https://www.npmjs.com/package/koa-router就是一 ...
- redis原理及集群主从配置
一.简介 存储系统背景 存储系统有三类: RDBMS oracle,dh2,postgresql,mysql,sql server NoSQL: KV NoSQL:redis,memcached 列式 ...
- Java定时任务工具详解之Timer篇
Java定时任务调度工具详解 什么是定时任务调度? ◆ 基于给定的时间点,给定的时间间隔或者给定的执行次数自动执行的任务. 在Java中的定时调度工具? ◆ Timer ◆Quartz T ...
- 3_PHP表达式_2_变量
以下为学习孔祥盛主编的<PHP编程基础与实例教程>(第二版)所做的笔记. PHP变量可分为自定义变量和预定义变量. 以下所谈到的变量均为自定义变量. 1.变量的基本概念 PHP的变量名遵循 ...