Tất cả bài viết | Bootstrap
Cách tạo trang Slide quảng cáo đơn giản bằng Bootstrap
Trong bài học thiết kế website chuyên nghiệp này các Bạn sẽ được hướng dẫn Cách tạo trang Slide quảng cáo đơn giản bằng Bootstrap
Bước 1: Tạo cấu trúc HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | < div class = "container" > < h1 class = "text-center" >Tạo trang Slide quảng cáo đơn giản bằng Bootstrap</ h1 > < div class = "row" > < div class = "col-md-6 col-md-offset-3" > < div id = "myCarousel" class = "carousel slide" > < div class = "carousel-inner" > < div class = "item active" > < a href = "http://hocwebgiare.com/dao-tao-online/Chuyen-vien-website-lanh-nghe-online.html" target = "_blank" >< img class = "thumbnail" src = "http://hocwebgiare.com/thiet_ke_web_chuan_demo/slide_ads/images/hoc_thiet_ke_web_gia_re_online.png" alt = "Khóa học Chuyên viên website lành nghề Online" ></ a > </ div > < div class = "item" > < a href = "http://hocwebgiare.com/dao-tao-online/Lap-trinh-HTML5-CSS3-RWD-Javascript-Bootstrap-Online.html" target = "_blank" >< img class = "thumbnail" src = "http://hocwebgiare.com/thiet_ke_web_chuan_demo/slide_ads/images/hoc_bootstrap_online.png" alt = "Khóa học Lập trình HTML5, CSS3, RWD, Javascript, Bootstrap Online" ></ a > </ div > < div class = "item" > < a href = "http://hocwebgiare.com/dao-tao-online/Thiet-ke-giao-dien-website-online.html" target = "_blank" >< img class = "thumbnail" src = "http://hocwebgiare.com/thiet_ke_web_chuan_demo/slide_ads/images/thiet_ke_giao_dien_web.png" alt = "Khóa học Thiết kế giao diện website Online" ></ a > </ div > < div class = "item" > < a href = "http://hocwebgiare.com/dao-tao-online/Lap-trinh-PHP-Co-Ban-Online.html" target = "_blank" >< img class = "thumbnail" src = "http://hocwebgiare.com/thiet_ke_web_chuan_demo/slide_ads/images/php.png" alt = "Khóa học Lập trình PHP Cơ Bản Online" ></ a > </ div > </ div > < div class = "carousel-controls" > < a class = "carousel-control left" href = "http://hocwebgiare.com/cpadmin/form_blog.php?ID_blog=218#myCarousel" data-slide = "prev" >< span class = "fa fa-angle-double-left" ></ span ></ a > < a class = "carousel-control right" href = "http://hocwebgiare.com/cpadmin/form_blog.php?ID_blog=218#myCarousel" data-slide = "next" >< span class = "fa fa-angle-double-right" ></ span ></ a > </ div > </ div > </ div > </ div > </ div > |
Bước 2: Định dạng CSS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | body { padding-top: 0px; } .carousel-inner .item img { width:100%; height:100%; } .item .thumbnail { margin-bottom:0; } .carousel-control.left, .carousel-control.right { background-image:none !important; } .carousel-control { background: #39b3d7; color:#fff; padding: 0px 0; width:26px; top:auto; left:auto; bottom:8px; opacity:0.4; text-shadow:none; } .carousel-control.right { right:10px; } .carousel-control.left { right: 40px; } |
Bước 3: Gọi thư viện Bootstrap
1 | < link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" > <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"> </script> |
Bước 4: Gọi thư viện JQUERY
1 | <script src="js/jquery-1.11.1.min.js"> </script> |
Bước 5: Tạo hiệu ứng Slide bằng JQUERY
1 2 3 | $('#myCarousel').carousel({ interval: 4000 }); |
Bootstrap Xem (5607) Học thiết kế web giá rẻ