Công cụ tạo button tùy chỉnh

Top Menu có nút Ẩn, Hiện

_Đây là Top Menu được đặt ở đầu blog và có nút ( Button ) Ẩn, Hiện. Các bạn có thể xem Demo
Các bạn bấm Update bên dưới để xem kết quả.
Source CodeResult


Dashboard→ Mẫu→ Chỉnh sửa Html. Sử dụng cặp phím [Control+F] để tìm các thẻ:
 _Đầu tiên các bạn đặt code CSS vào trước thẻ đóng ]]</b:skin>
 _Copy Javascript đặt trong cặp thẻ <head>...</head>
 _Code Html đặt ngay sau thẻ <body>
Save và trở lại trang Web xem kết quả.
Click button: xem code


Code:


Bạn có thể test thử trên Test Html Editor
Link to this page:

Download Button Set

Download Button Set

Download Button Set

Đây là bộ 'Download Button'
Sưu tầm trên trang cssdeck.com: tác giả Kushagra Agarwal; không sử dụng bất cứ link ảnh nào.
Ưu thế về tốc độ load, là bộ sưu tập đẹp,và bạn có thể tùy biến nội dung button.

TTP © 2014


Code riêng cho grey button:
Html
<style>
  a.button {
    position: relative;
    height: 15px;
    padding: 12px 20px 15px 68px;
    cursor: pointer;
    text-align: Right;
    font-weight: bold;
    font-size: 18px;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    -webkit-box-shadow: 2px 2px 2px 0 rgba(0,0,0,.3);
    -moz-box-shadow: 2px 2px 2px 0 rgba(0,0,0,.3);
    box-shadow: 2px 2px 2px 0 rgba(0,0,0,.3);
    display: inline-block !important;
    font: 700 15px 'Arial', Helvetica, Clean, sans-serif;
    margin: 0px 0px 20px 10px;
    position: relative;
    text-decoration: none;
    transition: background-position .2s ease, margin .1s ease;
    -webkit-transition: background-position .2s ease, margin .1s ease;
    -moz-transition: background-position .2s ease, margin .1s ease;
    background-repeat: repeat-x;
}
a.button:hover { background-position: 0 10px }
a.button:active {
    -webkit-box-shadow: -1px -1px 2px 0 rgba(0,0,0,.3);
    -moz-box-shadow: -1px -1px 2px 0 rgba(0,0,0,.3);
    box-shadow: -1px -1px 2px 0 rgba(0,0,0,.3);
    margin: 2px 0 20px 10px;
}
a.button span.bar {
    width: 1px;
    height: 30px;
    position: absolute;
    background: black;
    top: 5px;
    left: 50px;
}
a.button div.arrow {
    position: absolute;
    left: 20px;
    top: 14px;
}
a.button div.arrow span.top {
    position: absolute;
    width: 6px;
    height: 9px;
    background: #000;
    top: 0;
    left: 3px;
}
a.button div.arrow span.bottom,
div.arrow span.bottomShadow {
    position: absolute;
    width: 0px;
    height: 0px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid black;
    top: 9px;
    left: -2px;
    z-index: 2;
}
a.button div.arrow span.bottomShadow {
    z-index: 1;
    left: -1px;
}
/* GRAY
   ================================================== */
a.grey {
    background-color: #888;
    background-image: -webkit-linear-gradient(top, #888, #333);
    background-image: -moz-linear-gradient(top, #888, #333);
    background-image: -ms-linear-gradient(top, #888, #333);
    background-image: -o-linear-gradient(top, #888, #333);
    background-image: linear-gradient(top, #888, #333);
    text-shadow: 1px 1px 1px rgba(255,255,255,.2);
    border-top: 1px solid #aaa;
}
a.grey span.bar {
    -webkit-box-shadow: 1px 1px 1px rgba(255,255,255,.2);
    -moz-box-shadow: 1px 1px 1px rgba(255,255,255,.2);
    box-shadow: 1px 1px 1px rgba(255,255,255,.2);
}
a.grey div.arrow span.top {
    -webkit-box-shadow: 1px 1px 1px rgba(255,255,255,.2);
    -moz-box-shadow: 1px 1px 1px rgba(255,255,255,.2);
    box-shadow: 1px 1px 1px rgba(255,255,255,.2);
}
a.grey div.arrow span.bottomShadow { border-top: 8px solid rgba(255, 255, 255, 0.2) }
</style>
<br />
<div class="container" >
<a class="button grey" href="Link Download Here">
 <div class="arrow">
<span class="top"></span>
    <span class="bottom"></span>
    <span class="bottomShadow"></span>
  </div>
  <span class="bar"></span>
  Download
</a>



Bạn có thể test thử trên Test Html Editor
Link to this page:


Button Ẩn, Hiện nội dung

Để tạo Button có nội dung ẩn, hiện bằng nút (button) bấm, xem demo:

Nội dung bạn cần đưa vào, bấm ẦN để đóng lại
Để tạo nút bấm giống như demo này ,bạn cần thêm css cho button:
<style>
 .button:hover {
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyz6v0On75CLOeaHMCbk3upuBBUnYWZqFVIoMEZAU2FYSoBiwLejtwG1wVoo24FreFDCaoT7TxyO5XQYY47w7Qh1VMg93OPMhe0q-v2dw1YVbrhPn3yuIYbHbmlGNeoCQG4-ZHpxaSAjI/s1600/but-img_in.png)  repeat-x scroll 0 0 rgba(0, 0, 0, 0);color: #00248E;border: 1px solid #777
}
.button {
    background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkZ2c1B98TWZvl-_20EQbjAL9scMzUUfvqleIJeglBokg82ybQSOdoeQaqrBuMOhwKXu2qi35j5yoNDZjHImKVtNQ2OZtct0OUX1MVFA239jf2huheJiwWlaHNsahobsqDvLEJaSfM5sY/s1600/but-im_gout.png)  repeat-x scroll 0 0 rgba(0, 0, 0, 0);
    border: 1px solid #555;
    color: #fff;
    cursor: pointer;
    font-family: arial,serif;
    font-size: 12px;
    font-weight: bold;
    height: 20px;
    margin: 0 0 10px;
    padding: 3px 10px 0;
}
</style>

Dùng đoạn code bên dưới:
Html
<style>
    .button:hover {
        background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyz6v0On75CLOeaHMCbk3upuBBUnYWZqFVIoMEZAU2FYSoBiwLejtwG1wVoo24FreFDCaoT7TxyO5XQYY47w7Qh1VMg93OPMhe0q-v2dw1YVbrhPn3yuIYbHbmlGNeoCQG4-ZHpxaSAjI/s1600/but-img_in.png) repeat-x scroll 0 0 rgba(0, 0, 0, 0);
        color: #00248E;
        border: 1px solid #777
    }
    
    .button {
        background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkZ2c1B98TWZvl-_20EQbjAL9scMzUUfvqleIJeglBokg82ybQSOdoeQaqrBuMOhwKXu2qi35j5yoNDZjHImKVtNQ2OZtct0OUX1MVFA239jf2huheJiwWlaHNsahobsqDvLEJaSfM5sY/s1600/but-im_gout.png) repeat-x scroll 0 0 rgba(0, 0, 0, 0);
        border: 1px solid #555;
        color: #fff;
        cursor: pointer;
        font-family: arial, serif;
        font-size: 12px;
        font-weight: bold;
        height: 20px;
        margin: 0 0 10px;
        padding: 3px 10px 0;
    }

</style>
<div class="bigfont" style="margin-bottom: 0px;background-color: #e6e6e6; border: 1px solid rgb(66, 66, 66);border-bottom:none; height: auto; margin: 0px 0px; padding: 10px; text-align: left; width: auto;">
    <input class="button" onclick="if 
(this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display
 != '') { 
this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display
 = ''; this.innerText = ''; this.value = 'Ẩn'; } else { 
this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display
 = 'none'; this.innerText = ''; this.value = 'Hiện'; }"
    style="margin: 0px; padding: 0px; width: 60px;"
    type="button" value="Xem" />
</div>
<div style="background-color: #e6e6e6; border: 1px solid rgb(66, 66, 66); height: auto; margin: 0px 0px;border-top:none; padding: 10px ; text-align: left; width: auto;">
    <div style="display: none;">
        noi dung
    </div>
</div>

Demo và nhận code:
Code Result



noi dung

Nếu các bạn muốn sử dụng Js để mở rộng nội dung text. Xem Demo:
  • Css
    body { margin: 20px; } #displayText { text-decoration: none; margin: 20px; } /* only for demo**********/
  • Javascript
    function expand() { var ele = document.getElementById("expandText"); var text = document.getElementById("displayText"); if(ele.style.display == "block") { ele.style.display = "none";//nếu muốn hiện sẵn thì trong id= "expandText" style="display:block" text.innerHTML = "show";//"show"thay đổi text theo ý bạn } else { ele.style.display = "block"; text.innerHTML = "hide";//"hide"thay đổi text theo ý bạn } }
  • Html
    <a id="displayText" href="javascript:expand();">Show</a> <div id="expandText" style="display:none">Hi @every body !<br> My site: testtemplatekhoi.blogspot.com</div>
  • Result
    Click Show


Và dùng link ảnh mở rộng nội dung:(Source: randomsnippets.com)
  • Css(none)
    Bạn có thể thêm css tùy ý
  • Javascript
    function toggle5(showHideDiv, switchImgTag) { var ele = document.getElementById(showHideDiv); var imageEle = document.getElementById(switchImgTag); if(ele.style.display == "block") { ele.style.display = "none"; imageEle.innerHTML = '<img src="http://icons.iconarchive.com/icons/icons8/ios7/48/Arrows-Down-4-icon.png">'; } else { ele.style.display = "block"; imageEle.innerHTML = '<img src="http://icons.iconarchive.com/icons/icons8/ios7/48/Arrows-Up-4-icon.png">'; } }
  • Html
    <div id="headerDivImg"> <div id="titleTextImg">Let's use images link!</div> </div> <!--thẻ a có thể đặt ở đây--> <div id="contentDivImg" style="display: none;"> Lorem Ipsum is simply dummy text of the printing and typesetting industry.<br> Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. <br>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. <br>It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div> <a id="imageDivLink" href="javascript:toggle5('contentDivImg', 'imageDivLink');"><img src="http://icons.iconarchive.com/icons/icons8/ios7/48/Arrows-Down-4-icon.png"></a>
  • Result
    Let's use images link!click arrow-up


Bạn có thể test thử trên Test Html Editor
Link to this page:

Tạo nút ( Button ) Refresh cho blogspot

Để tạo nút Button Refresh trang ta dùng đoạn code sau:
Code Result

Bấm thử vào nút Refresh để xem hiệu quả
Bạn cũng có thể dùng đoạn code dưới đây để Refresh:
<a href="javascript:document.location.reload();" >refresh</a>
Hãy vào trang HTML Editor để thử kết quả

(✽) _Bạn có thể xem thêm:

Công cụ tạo button tùy chỉnh

Ngày

 
Support : Hổ trợ | Your Link | Your Link
Copyright © 2013. ProShow Producer - All Rights Reserved
Template Created by Creating Website Published byMas Template
Proudly powered by Blogger