Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> CSS

Cách tạo kiểu nút tải xuống (download button) bằng CSS

Dưới đây là mã nguồn để tạo kiểu nút tải xuống (download button) đẹp mắt bằng CSS và Font Awesome:

Ví dụ

<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <style> button{ background-color: rgb(78, 15, 129); border: none; color: white; padding: 12px 30px; cursor: pointer; font-size: 30px; font-weight: bolder; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } button:hover{ background-color: rgb(42, 7, 82); } h1{ text-align: center; } </style> </head> <body> <h1>Download Buttons Styling Example</h1> <h1>Button 1</h1> <button style="margin-left:33%;"><i class="fa fa-download"></i> DOWNLOAD NOW</button> <h1>Button 2</h1> <button style="text-align: center; width: 100%;"><i class="fa fa-download"></i> DOWNLOAD NOW</button> </body> </html>

Kết quả

Mã trên sẽ cho ra kết quả như sau:

Cách tạo kiểu nút tải xuống (download button) bằng CSS