您现在的位置是:首页 > 学无止境 > html5|css3|javascript 网站首页学无止境

Html+css怎样实现纯文字和带图标的按钮

简介 Html+css怎样实现纯文字和带图标的按钮,Html+css实现纯文字和带图标的按钮的注意事项有哪些,下面就是实战案例,一起来看一下.....

Html+css怎样实现纯文字和带图标的按钮

Html+css怎样实现纯文字和带图标的按钮,Html+css实现纯文字和带图标的按钮的注意事项有哪些,下面就是实战案例,一起来看一下。

本文总结一下一些基础页面元素的实现方式,后续陆续更新。首先我们遇到最多的可能是按钮的切图,按钮可能有很多种外观,但是一般可分为纯文字的和带图标的按钮,下面就来说说这两种按钮的实现方法。

效果图:

Html+css怎样实现纯文字和带图标的按钮

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>各类按钮的html实现(css)</title>  
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">       
<style type="text/css">     
  a:hover{text-decoration: none;}     
  .btn{     
    display: inline-block;     
    margin-top: 10px;     
    padding: 10px 24px;     
    border-radius: 4px;     
    background-color: #63b7ff;     
    color: #fff;     
    cursor: pointer;     
  }     
  .btn:hover{     
    background-color: #99c6ff;     
  }     
  .inbtn{     
    border: none;     
  }     
  .bubtn{     
    border: none;     
  }     
  .btn{     
    font-style: normal;     
  }     
  .bgbtn span{     
    margin-left: 10px;     
    padding-left: 20px;     
    background: url(images/edit.png) left center no-repeat;     
  }     
  .bgbtn02 img{     
    margin-bottom: -3px;     
    margin-right: 10px;     
  }     
</style>     
</head>     
<body>   
  
<!--<a>标签按钮-->    
<a href="" class="btn">a标签按钮</a>    
 
   <!-- <input>标签按钮 -->    
<input class="inbtn btn" type="button" value="input标签按钮"/>   
  
   <!-- <button>标签按钮 -->    
<button class="bubtn btn">button标签按钮</button>  
   
   <!-- <i>等 任意标签按钮 -->    
<i class="ibtn btn">i标签按钮</i>   
  
  <!-- 带背景图标按钮 -->    
<a href="" class="bgbtn btn">
  <span>带图标按钮</span>     
</a>  

   <!--带图标按钮-->    
<a href="" class="bgbtn02 btn">     
  <img src="http://img1001.pocoimg.cn/image/poco/works/87/2018/0906/14/15362156223287880_56337008_H1920.png"  height="22" />带图标按钮     
</a> 
    
</body>     
</html>

发现一个好工具,在线测试Html代码:http://www.w3school.com.cn/tiy/t.asp?f=html5_video_all

·

文章评论

Top