Thứ Hai, 2 tháng 7, 2012

CSS - Tạo Khung Bo Tròn

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

Vấn đè là ta muốn tạo một khung cho văn bản hay khung ảnh mà gốc của khung không phải là gốc vuông mà là gốc bo tròn  ( góc vuông bi cắt xén đi phần chốt nhọn ) thì ta làm sao ? CSS sau sẽ giúp bạn làm điều đó .
Demo:
<html>
<head>
<style type="text/css">
div#conner {
margin: 0 2%;background:blue;/* mau nay phri giong mau duoi*/
}
b.rtop, b.rbottom {
display:block;background:#FFF;/* mau nay khong thay doi*/
}
b.rtop b, b.rbottom b {
display:block;
height: 1px;
overflow: hidden;

background:blue;/* mau nay phai giong mau tren*/
}
b.r1 {
margin: 0 5px /* le trai +phai = 0, tren +duoi =5 */
}
b.r2 {
margin: 0 3px
}
b.r3 {

margin: 0 2px
}
b.r4 {

margin: 0 1px
}
b.rtop b.r4, b.rbottom b.r4 {
margin: 0 1px;height: 2px
}
</style>
</head>


<body>
<div id="conner" align="center">
<b class="rtop">
<b class="r1"></b>
<b class="r2"></b>
<b class="r3"></b>
<b class="r4"></b>
</b>
<h4> Noi de viet cai khi kho gi do </h4>
<b class="rbottom">
<b class="r4"></b>
<b class="r3"></b>
<b class="r2"></b>
<b class="r1"></b>
</b>
</div>

</body>
</html>
Hình minh họa:



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

Posted by Unknown 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 Unknown 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>



Xem Nhiều

Bài đăng phổ biến

Lưu trữ blog

Blog Archive