Hiển thị các bài đăng có nhãn Html - Css. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Html - Css. Hiển thị tất cả bài đăng

Chủ Nhật, 25 tháng 12, 2016

Tạo Button Với Hiệu Ứng Hover Đơn Giản Bằng CSS3

Xin Chào, blog sẽ chia sẻ cho các bạn một mẫu button rất đáng để các bạn sử dụng trên các trang blog hay web của mình. Nếu không thích thì các bạn cũng có thể học thêm được nhiều về CSS3 với những thuộc tính mà nó tạo hiệu ứng cho button này.

HTML
Các bạn chỉ cần khung chuẩn html cho button đơn giản như sau :

<button>Vũ Tiến Anh Blog !</button>
CSS
Các bạn chỉ cần copy đoạn css sau :
button{

background:#1AAB8A;

color:#fff;

border:none;

position:relative;

height:60px;

font-size:1.6em;

padding:0 2em;

cursor:pointer;

transition:800ms ease all;

outline:none;

}

button:hover{

background:#fff;

color:#1AAB8A;

}

button:before,button:after{

content:'';

position:absolute;

top:0;

right:0;

height:2px;

width:0;

background: #1AAB8A;

transition:400ms ease all;

}

button:after{

right:inherit;

top:inherit;

left:0;

bottom:0;

}

button:hover:before,button:hover:after{

width:100%;

transition:800ms ease all;

}
Không quá khó để các bạn hiểu rõ đoạn css trên phải không ? Mình tin rằng các bạn sẽ có thêm ý tưởng cho những mẫu thiết kế web sau này.
Chúc các bạn thành công !
Theo Chiase78.Blogspot.Com

Thứ Bảy, 10 tháng 12, 2016

Share Code Đếm Ngược Giáng Sinh 2016 Đơn Giản

Xin Chào, Giáng sinh cũng đã gần đến blog sẽ luôn sưu tầm và tổng hợp lại những code hay về Ngày Giáng Sinh 2016 này. 

Ở bài trước mình cũng đã chia sẻ một code về đếm ngược giáng sinh bạn có thể tham khảo :
Tạo bộ lịch đếm ngược có ghi lời chúc giáng sinh độc đáo
Tiếp bài này mình sẽ chia sẻ cho bạn code đơn giản và đẹp hơn.

 Bắt Tay Vào Làm Thôi :D
1. CSS

<style type="text/css">
body {
font-family: 'Mountains of Christmas', cursive;
color: #ffffff;
background: #C0392B;
background: repeating-linear-gradient(
45deg,
#E74C3C,
#E74C3C 10px,
#C0392B 10px,
#C0392B 20px);
}

.christmas-bg {
background: repeating-linear-gradient(
45deg,
#2ECC71,
#2ECC71 10px,
#27AE60 10px,
#27AE60 20px
);
}

.notxmas-bg {
background: repeating-linear-gradient(
45deg,
#34495E,
#34495E 10px,
#2C3E50 10px,
#2C3E50 20px
);
}

#mainwrap {
padding-top: 10px;
padding-bottom: 60px;
}

.img-center {
display: block;
margin-left: auto;
margin-right: auto;
}

.sleep-number {
font-family: 'Montserrat', sans-serif;
line-height: 1;
}

@media (min-width: 768px) {
.sleep-number {
font-size: 300px;
}
}

@media (max-width: 767px) {
.sleep-number {
font-size: 150px;
}
}

@media (max-width: 480px) {
.sleep-number {
font-size: 90px;
}
}

@media (min-width: 481px) {
.sleep-text {
font-size: 80px;
}
}

@media (max-width: 480px) {
.sleep-text {
font-size: 40px;
}
}

@media (max-width: 480px) {
#xmasimg {
max-width: 200px;
}
}
</style>
2. HTML

<div class="container">
<div id="mainwrap" class="col-md-8 col-md-offset-2 text-center">
<a href="http://iris-tips.blogspot.com/p/play.html?url=https://santatracker.google.com/village.html&amp;download=http://iris-tips.blogspot.com/" target="_blank"><img id="xmasimg" src="https://dl.dropboxusercontent.com/s/5uqou2o4ya9agh1/bell-120px.png"/></a>
<div id="sleeps" class="sleep-number">-</div>
<div id="text" class="sleep-text">Sleeps Until Christmas</div>
</div>
</div>
3.Javascript

<script type='text/javascript'>
$(document).ready(function() {

var sleepsTo = 0;
var monthDaysUntil = [359, 328, 300, 269, 239, 208, 178, 147, 116, 86, 55, 25];
var picAPic = ["630n0zf4ejjqhb3/snowman-120px.png", "a9v1dtgs9m4g5h3/firestove-120px.png" ,"5uqou2o4ya9agh1/bell-120px.png", "cqn10s10hv9xtne/cookie-120px.png", "k54f3genpvbqr3e/christmasstar-120px.png", "yqpfttxnara7cx7/candy-120px.png", "hhu9jsyhuk39954/ribbon-120px.png", "qqbd9ui5t5wrwoy/stick-120px.png", "f2uaiqo50kecdwl/christmas-tree-120px.png", "mdd0v8rn0zf5dcq/rocket-120px.png", "f9n2w4nfujleve3/rudolph-120px.png", "bmu0m8wxqjvbksz/santacart-120px.png", "ilrzah9sw95ezwr/calendarchristmas-120px.png", "9ox8sbx4s0va0xo/sinterclaus-120px.png"];
var today = new Date();

// add a day to Jan and Feb if a leap year
var isLeap = new Date(today.getYear(), 1, 29).getMonth() == 1;
if (today.getMonth() == 11 && today.getDate() > 25) {
isLeap = new Date((today.getYear()+1), 1, 29).getMonth() == 1;
};
if(isLeap) {
monthDaysUntil[0] = 360;
monthDaysUntil[1] = 329;
};

//set the bg
if (today.getMonth() == 11) {
$('#mainwrap').addClass('christmas-bg');
}
else {
$('#mainwrap').addClass('notxmas-bg');
}

//set the sleeps to Xmas
if (today.getMonth() == 11 && today.getDate() > 25) {
sleepsTo = (31 - today.getDate()) + monthDaysUntil[0];
$('#sleeps').text(sleepsTo);
$("#xmasimg").attr("src","https://dl.dropboxusercontent.com/s/" + picAPic[13]);
}
else {
sleepsTo = monthDaysUntil[today.getMonth()] - today.getDate();
$('#sleeps').text(sleepsTo);
$("#xmasimg").attr("src","https://dl.dropboxusercontent.com/s/" + picAPic[today.getMonth()]);
}

// 1 sleep
if(sleepsTo == 1) {
$('#text').text("Sleep Until Christmas");
};

//if ITS CHRISTMAS!!!!
if(sleepsTo == 0) {
$('#sleeps').text("-");
$('#text').text("Ho, Ho, Ho, it's Christmas!!!");
$("#xmasimg").attr("src","https://dl.dropboxusercontent.com/s/" + picAPic[12]);
};
});

</script>


Lời Kết : Chúc Các Bạn Thành Công :D

Tạo bộ lịch đếm ngược có ghi lời chúc giáng sinh độc đáo

Xin Chào, Giáng sinh đã đến gần hãy cùng Blog tạo một bộ lịch đếm ngược có ghi những lời chúc giáng sinh đầy ngộ nghĩnh và đáng yêu nhé.

Mặc định tiện ích này sẽ có 25 ô tương ứng với các ngày trong tháng 12 từ 1 đến 25 (Noel). Khi thời gian trôi đến ngày nào tiện ích sẽ lật mở ô chứa lời chúc của ngày đó và sẽ đếm ngược lần lượt cho đến ngày Noel.


Cách thực hiện
1. CSS

<style type="text/css">
@import url(http://fonts.googleapis.com/css?family=Oleo+Script);body{background:url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/62105/xmas.jpg");color:#fff;font-family:'Oleo Script',cursive;padding:20px;font-weight:400}
h1{margin:0;font-size:75px;line-height:75px;text-align:center;font-weight:400}
ul{margin:0 auto 30px auto;padding:0;list-style-type:none;max-width:900px;width:100%;text-align:center;user-select:none}
li{font-weight:400;background-color:#fff;box-sizing:border-box;border-radius:6px;display:inline-block;color:#111;cursor:pointer;font-size:26px;padding:15px;margin:25px 12px;width:130px;height:130px;line-height:100px;text-align:center;position:relative;vertical-align:top;user-select:none;perspective:800px;transition:all 0.4s ease-in-out}
ul li:last-child{background:url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/62105/santa.jpg") center top;background-size:cover;display:block;clear:both;margin:20px auto 0 auto;width:200px;height:275px}
ul li:last-child .door{font-size:100px;width:200px;height:275px;line-height:240px}
ul li:last-child .revealed{line-height:123px}
.door{user-select:none;color:#fff;font-size:70px;position:absolute;top:0;left:0;background-color:#91c1cc;box-sizing:border-box;border-top:2px #eee dashed;border-right:2px #eee dashed;border-bottom:2px #eee dashed;border-left:1px #eee solid;border-radius:6px;padding:15px;width:130px;height:130px;transform-origin:0 40%;transition:all 0.4s ease-in-out;transform-style:preserve-3d}
.current .door{background-color:#7EAD44}
.current .door.open{color:#7EAD44}
.revealed{user-select:none}
#message{box-sizing:border-box;color:#222;display:none;font-size:24px;padding:20px;background:#eddecb;max-width:500px;width:100%;border-radius:15px;margin:0 auto}
.open{box-shadow:14px 0 15px -1px rgba(0,0,0,0.2);color:#91c1cc;transform:rotate3d(0,1,0,-98deg)}
.jiggle{animation:jiggle 0.2s infinite;transform:rotate(-1deg)}
@keyframes jiggle{0%{transform:rotate(-1deg)}50%{transform:rotate(1deg)}}
@media screen and (min-width:480px){li{margin:25px 20px}}
@media screen and (min-width:768px){body{background-size:150px}p{right:6%;top:20%;bottom:auto;margin-left:auto;left:auto}}
</style>
2. HTML

<h1>Merry Christmas</h1>
<ul>
<li><div class="door">1</div></li>
<li><div class="door">2</div></li>
<li><div class="door">3</div></li>
<li><div class="door">4</div></li>
<li><div class="door">5</div></li>
<li><div class="door">6</div></li>
<li><div class="door">7</div></li>
<li><div class="door">8</div></li>
<li><div class="door">9</div></li>
<li><div class="door">10</div></li>
<li><div class="door">11</div></li>
<li><div class="door">12</div></li>
<li><div class="door">13</div></li>
<li><div class="door">14</div></li>
<li><div class="door">15</div></li>
<li><div class="door">16</div></li>
<li><div class="door">17</div></li>
<li><div class="door">18</div></li>
<li><div class="door">19</div></li>
<li><div class="door">20</div></li>
<li><div class="door">21</div></li>
<li><div class="door">22</div></li>
<li><div class="door">23</div></li>
<li><div class="door">24</div></li>
<li><div class="door">25</div></li>
</ul>

<p id="message"></p>
3.Javascript

<script type='text/javascript'>
$( document ).ready(function() {

var words = ["Christmas ", "is ", "love", "and", "ioy.", "Christmas", "is", "caring,", "giving", "and", "sharing.", "Christmas", "is", "the", "most", "wonderful", "feeling", "of", "the", "year.", "And", "one", "more", "thing", "Merry Christmas!"];

var message = "";
var date = new Date();
var day = date.getDate();
var month = date.getMonth() + 1;
var scrolled = false;
var timeDelay = 200;

// function to reveal message
var cardReveal = function() {
$("#message").text(message).show();
}

//day=25; // uncomment to skip to 25

// Only work in December
if(month === 12) {
// Loop through each calendar window
$("li").each( function( index ) {
var adventwindow = index + 1;
var item = $(this);

// Open past windows
if( day !== adventwindow && adventwindow < day ) {
window
.setTimeout(function(){
item
.children(".door").addClass("open");
}, timeDelay);
}

// timeout offset for past window opening animation
timeDelay
+= 100;

// Add words so far to message variable
if( adventwindow <= day ) {
var word = words[index];
$(this).append('<div class="revealed">' + word + '</div>');
message
= message + " " + word;
}

// Add jiggle animation to current day window
if(adventwindow === day) {
$(this).addClass("current");
$(this).addClass("jiggle");
}

// On clicking a window, toggle it open/closed and
// handle other things such as removing jiggle and 25th
$(this).on("click", function() {
if(adventwindow <= day) {
$(this).children(".door").toggleClass("open");
}

$(this).removeClass("jiggle");

// If 25th, can show the message
if(day >= 25 && adventwindow === 25) {
messageReveal();

// Animate scroll to message if not already done
if(!scrolled) {
$('html, body').animate({
scrollTop
: $("#message").offset().top
}, 2000);
scrolled
= true;
}
}
});

});

// If beyond 24, show message
if(day >= 26){
messageReveal();
}

}

});
</script>
Các Bạn Sửa Chữa "Christmas ", "is ", "love", "and", "ioy.", "Christmas", "is", "caring,", "giving", "and", "sharing.", "Christmas", "is", "the", "most", "wonderful", "feeling", "of", "the", "year.", "And", "one", "more", "thing", "Merry Christmas!" Trên Sao Cho Đúng ý Của Bạn nhé!



Lời Kết : Chúc Các Bạn Thành Công :D