本篇文章给大家分享如何用css创建一个带有图像图标的按钮,内容很详细,有感兴趣的朋友可以看一看。
在按钮表面上显示图像图标时,请写代码以在按钮标签中显示图像,实现此效果要使用显示设置为内联块的span标记。
代码如下:
image-button.css
#buttonImage { background-image:url('/img/search.png'); display:inline-block; margin-top:2px; width:16px; height:16px; } .flatbutton{ border:1px solid #3079ed; background-color:#4d90fe; width:100px; height:28px; }
image-button.html
立即学习“前端免费学习笔记(深入)”;
<!DOCTYPE html> <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <link rel="stylesheet" type="text/css" href="image-button.css" /> </head> <body> <button class="flatbutton"><span id="buttonImage"></span></button> </body> </html>
效果如下:
以上就是CSS如何创建图像图标按钮(附代码)的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号