This article mainly introduces the methods of implementing plain text and icon buttons with Html and css. Buttons have many appearances. This article introduces two types of buttons, pure text and icons. Interested friends can refer to it
This article summarizes the implementation methods of some basic page elements and will be updated in the future. First of all, the most common thing we encounter is the cutout of buttons. Buttons may have many appearances, but they can generally be divided into plain text buttons and buttons with icons. Let’s talk about the implementation methods of these two buttons. The rendering is as follows:
The code is as follows:
XML/HTML
<!DOCTYPE html> <html lang="zh-CN"> <head> <title>按钮写法</title> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <link rel="stylesheet" href="css/style.css"> <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 class="ibtn btn">i标签按钮</i> <!--带背景图标按钮--> <a href="" class="bgbtn btn"> <span>带图标按钮</span> </a> <a href="" class="bgbtn02 btn"> <img src="images/edit.png"/>带图标按钮 </a> </body> </html>
As for the advantages of various tags The shortcomings still need to be experienced by everyone. If you have any interesting buttons to write, we will implement them together.
The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
Tips on setting HTML table borders
The above is the detailed content of Html and css code to implement plain text and buttons with icons. For more information, please follow other related articles on the PHP Chinese website!