Thứ Hai, 2 tháng 7, 2012

CSS - Phóng To Ảnh Khi Rê Chuột Lên

Posted by Z-CLICK Thứ Hai, tháng 7 02, 2012, under | 1 comment

Vấn đề là ta có bức ảnh khi đưa lên Web ta jumb lại với kích thướt nhỏ, làm sao khi user muốn xem kích thướt thật của ảnh, ta dùng CSS để trả lại kích thướt thật khi rê chuột lên ảnh.
Demo:
<html>
<head>
<style type='text/css'>
.img-thumbnail{
position: relative;
z-index: 0;
}
.img-thumbnail:hover{
background-color: transparent;
z-index: 50;
}
.img-thumbnail span{
position: absolute;
background-color: #ffffff;
padding: 5px;
left: -100px;
border: 1px solid #000;
visibility: hidden;
color: black;
text-decoration: none;
}
.img-thumbnail span img{
border-width: 0;
padding: 2px;
}
.img-thumbnail:hover span{
visibility: visible;
top: -75x;/* thay doi chi so de anh hien o vi tri mong muon*/
left:-1px;/* thay doi chi so de anh hien o vi tri mong muon*/
}
</style>
</head>
<body>
<a class="img-thumbnail" href="#">
<img src="thiennhien.jpg" border="0" height="100" width="110"/>
<span>
<img src="thiennhien.jpg"/>
</span>
</a>
</body>
</html>

Hình minh họa khi chưa re chuột:

Hình minh họa khi rê chuột :




CSS - Tạo Hiệu Ứng Khi Trỏ Chuột

Posted by Z-CLICK Thứ Hai, tháng 7 02, 2012, under | No comments

Giả sử ta muốn cho  Pro một chút khi chuột rê vào một liên kết thì ta dung code CSS sau :
Demo:
<html>
<head>
<style type="text/css">
a:link {background-color:#B2FF99;} /* unvisited link */
a:visited {background-color:#FFFF85;} /* visited link */
a:hover {background-color:#FF704D;} /* mouse over link */
a:active {background-color:#FF704D;} /* selected link */
</style>
</head>
<body>
<p><b><a href="index.html" target="_blank">Trang Chu </a></b></p>/* co the thay doi dia chi lien ket .. */
</body>
</html>
Hình minh họa khi chưa trỏ chuột vào:

Hình minh họa khi trỏ chuột vào :


Demo: mở rộng code trên
<html>
<head>
<style type="text/css">
a.one:link {color:#ff0000;}
a.one:visited {color:#0000ff;}
a.one:hover {color:#ffcc00;}
a.two:link {color:#ff0000;}
a.two:visited {color:#0000ff;}
a.two:hover {font-size:150%;}
a.three:link {color:#ff0000;}
a.three:visited {color:#0000ff;}
a.three:hover {background:#66ff66;}
a.four:link {color:#ff0000;}
a.four:visited {color:#0000ff;}
a.four:hover {font-family:monospace;}
a.five:link {color:#ff0000;text-decoration:none;}
a.five:visited {color:#0000ff;text-decoration:none;}
a.five:hover {text-decoration:underline;}
</style>
</head>
<body>
<p>Mouse over the links to see them change layout.</p>
<p><b><a class="one" href="" target="_blank">This link changes color</a></b></p>
<p><b><a class="two" href="" target="_blank">This link changes font-size</a></b></p>
<p><b><a class="three" href="" target="_blank">This link changes background-color</a></b></p>
<p><b><a class="four" href="" target="_blank">This link changes font-family</a></b></p>
<p><b><a class="five" href="" target="_blank">This link changes text-decoration</a></b></p>
</body>
</html>
Demo: mở rộng code trên .
<html>
<head>
<style type="text/css">
a:link,a:visited
{
display:block;
font-weight:bold;
color:#FFFFFF;
background-color:#98bf21;
width:120px;
text-align:center;
padding:4px;
text-decoration:none;
}
a:hover,a:active
{
background-color:#7A991A;
}
</style>
</head>
<body>
<a href="" target="_blank">This is a link</a>
</body>
</html>


Chủ Nhật, 1 tháng 7, 2012

CSS - Tạo Khung Nhập Văn Bản Có Màu

Posted by Z-CLICK Chủ Nhật, tháng 7 01, 2012, under | No comments

Thông thường khung nhập liệu  của '' form " có nền là màu trắng, h ta muốn nó có màu ( cải lương tí nha! )thì ta làm sao? Dùng CSS .
Demo:
<html>
<head>
<style>
input[type="text"]
{
width:150px;
display:block;
margin-bottom:10px;
background-color:yellow; /* mau hop van ban,  ban co the thay doi thanh mau khac, hoac 1 anh .. */
}
input[type="button"]
{
width:120px;
margin-left:35px;
display:block;
}
</style>
</head>
<body>
<form name="input" action="" method="get">
Firstname:<input type="text" name="Name" value="Nhap" size="30">
Lastname:<input type="text" name="Name" value="Nhap" size="30">
<input type="button" value="Submit">
</form>
</body>
</html>
Hình minh họa:


CSS - Tạo Nút Bấm Di Chuyển

Posted by Z-CLICK Chủ Nhật, tháng 7 01, 2012, under | No comments

Ta thường thấy 1 số trang Web có các nút  mà khi nhấp chuột vào sẽ di chuyển đến trang chi định nào đó. Chẳn hạn nút "Home " có ảnh là hình ngôi nhà, nút " Next" có hình mui tên sang phải, nút "Prew" có hình mũi tên sang trái, nút "Center" có hình tròn ... . Để làm được vấn đề đó, ta phải có hình ảnh ( biểu tượng) của nút ( dùng chương trình photoshop để tạo chẳn hạn ), dùng code CSS để tạo tác vụ nhấp chuột,  sau cùng là chọn vị trí đặt nút đó.
Demo:
<html>
<head>
<style type="text/css">
#navlist{position:relative;}
#navlist li{margin:0;padding:0;list-style:none;position:absolute;top:0;}
#navlist li, #navlist a{height:44px;display:block;}

#home{left:0px;width:46px;}
#home{background:url('img_navsprites_hover.gif') 0 0;}
#home a:hover{background: url('img_navsprites_hover.gif') 0 -45px;}
*/ ban thay the anh 
img_navsprites_hover.gif bang anh khac  */

#prev{left:63px;width:43px;}
#prev{background:url('img_navsprites_hover.gif') -47px 0;}
#prev a:hover{background: url('img_navsprites_hover.gif') -47px -45px;}
/* thay the anh 
img_navsprites_hover.gif  bang anh khac */

#next{left:129px;width:43px;}
#next{background:url('img_navsprites_hover.gif') -91px 0;}
#next a:hover{background: url('img_navsprites_hover.gif') -91px -45px;}
 
/* thay the anh  img_navsprites_hover.gif bang anh khac */
</style>
</head>

<body>/* chon vi tri thich hop de dat  ID sau */
<ul id="navlist"> 
/* thay doi 3 link sau bang link thich hop*/ 
<li id="home"><a href="default.asp"></a></li>
<li id="prev"><a href="css_intro.asp"></a></li>
<li id="next"><a href="css_syntax.asp"></a></li>
</ul>
</body>
</html>
Hình minh họa:





Xem Nhiều

Bài đăng phổ biến

Lưu trữ blog

Blog Archive