zoukankan      html  css  js  c++  java
  • 防input required属性的提示框

    <!doctype html>
    <html>
    <head>
    	<meta charset = "utf-8">
    	<style>
    		*{
    			padding: 0;
    			margin: 0;
    		}
    		/*******气泡************/
    		.reminBox{
    			 150px;
    			height: 50px;	
    			position: relative;
    			top: 100px;
    			left: 100px;
    			background: #fff;
    			border: 1px solid #808080;
    			border-radius: 12px;
    		}
    		.reminBox:before{
    			content: "";
    			 0;
    			height: 0;
    			z-index: 1;
    			position: absolute;
    			top: -40px;
    			left: 22px;
    			border-top: 20px solid transparent;
    			border-right: 10px solid transparent;
    			border-bottom: 20px solid #fff;
    			border-left: 10px solid transparent;
    		}
    		.reminBox:after{
    			content: "";
    			 0;
    			height: 0;
    			position: absolute;
    			top: -40px;
    			left: 20px;
    			border-top: 20px solid transparent;
    			border-right: 12px solid transparent;
    			border-bottom: 20px solid #808080;
    			border-left: 12px solid transparent;
    		}
    		/*******感叹号**********/
    		.reminIcon{
    			position: absolute;
    			 26px;
    			height: 26px;
    			top: 12px;
    			left: 12px;
    			background: #ffa300;
    		}
    		.reminIcon:before{
    			position: absolute;
    			content: "";
    			 4px;
    			height: 13px;
    			background: #fff;
    			border: 1px solid #fff;
    			border-radius: 2px 2px 50% 50%;
    			top: 2px;
    			right: 10px;
    		}
    		.reminIcon:after{
    			position: absolute;
    			content: "";
    			 4px;
    			height: 4px;
    			background: #fff;
    			border: 1px solid #fff;
    			border-radius: 50%;
    			top: 18px;
    			right: 10px;
    		}
    		/*********文本********/
    		.reminText{
    			background: #fff;
    			position: absolute;
    			color: #000;
    			left: 50px;	
    			font-size: 12px;
    			top: 16px;
    		}
    	</style>
    </head>
    
    <body>
    	<script>
    		//获取父元素
    		let body = document.body;
    		//创建元素
    		let reminBox = document.createElement("div");
    		let reminIcon = document.createElement("div");
    		let reminText = document.createElement("div");
    		//设置class
    		reminBox.className = "reminBox";
    		reminIcon.className = "reminIcon";
    		reminText.className = "reminText";
    		//设置从属关系
    		body.append(reminBox);
    		reminBox.append(reminIcon);
    		reminBox.append(reminText);
    		//设置文本
    		reminText.innerText = "请填写此字段。";
    	</script>
    </body>
    
    </html>
    

     结果:

  • 相关阅读:
    通过Spring @PostConstruct 和 @PreDestroy 方法 实现初始化和销毁bean之前进行的操作
    Java注释@interface的用法
    java的一段对象数据类型映射的代码
    Google Protocol Buffer 的使用和原理
    MyISAM 和 InnoDB 讲解
    一个PHP写的简单webservice服务端+客户端
    提高php运行效率的50个技巧
    剑指Offer:二叉搜索树的后序遍历序列【33】
    剑指Offer:链表中环的入口节点【23】
    剑指Offer:删除链表的节点【18】
  • 原文地址:https://www.cnblogs.com/githubMYL/p/8819980.html
Copyright © 2011-2022 走看看