HTML(css.html)
<html><head>
<style type="text/css">
div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:myfirst 5s infinite;
animation-direction:alternate;
/* Firefox */
-moz-animation:myfirst 5s infinite;
-moz-animation-direction:alternate;
/* Safari and Chrome */
-webkit-animation:myfirst 5s infinite;
-webkit-animation-direction:alternate;
}
@keyframes myfirst
{
0% {background:red; left:0px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
}
@-moz-keyframes myfirst /* Firefox */
{
0% {background:red; left:0px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
}
@-webkit-keyframes myfirst /* Safari and Chrome */
{
0% {background:red; left:0px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
}
</style>
</head>
<body>
<table style="position:relative; ">
<tr>
<td>
<div></div></td>
</tr>
</table>
</body></html>
Note: This example does not work in Internet Explorer and Opera.
Download
Sumber : w3school
Tampilkan postingan dengan label CSS. Tampilkan semua postingan
Tampilkan postingan dengan label CSS. Tampilkan semua postingan
Z-index Css
Z-Index merupakan penempatan layer pada css, contoh:
HTML (index.html)
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<style>
.layer1{position:relative;
z-index:1;
top:0;
left:0;
background:#ff0000;
width:100px;
height:100px;
}
.layer2{
position:absolute;
z-index:0;
top:50px;
left:50px;
background:#eeeeee;
width:100px;
height:100px;
}
</style>
<body>
<div class="layer1"></div>
<div class="layer2"></div>
</body>
</html>
Demo :
HTML (index.html)
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<style>
.layer1{position:relative;
z-index:1;
top:0;
left:0;
background:#ff0000;
width:100px;
height:100px;
}
.layer2{
position:absolute;
z-index:0;
top:50px;
left:50px;
background:#eeeeee;
width:100px;
height:100px;
}
</style>
<body>
<div class="layer1"></div>
<div class="layer2"></div>
</body>
</html>
Demo :
Trik Css,change image on hover
HTML (css.html)
<html>
<head>
<title>Trik Css</title>
</head>
<style>
.panel{
background:url(images/1.png) top right no-repeat;
display:block;
background-attachment: initial;
background-origin: initial;
background-clip: initial;
background-color: initial;
background-position: 0% 100%;
}
#thumb{
opacity:0;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
}
#thumb:hover{
opacity:1;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
}
</style>
<body>
<table><tr><td>
<a href="#">
<span class="panel"><img src="images/2.png" alt="" id="thumb" ></span></a>
</td></tr></table>
</body>
</html>
Demo/example :
Note : Doesn`t work in ie.
<html>
<head>
<title>Trik Css</title>
</head>
<style>
.panel{
background:url(images/1.png) top right no-repeat;
display:block;
background-attachment: initial;
background-origin: initial;
background-clip: initial;
background-color: initial;
background-position: 0% 100%;
}
#thumb{
opacity:0;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
}
#thumb:hover{
opacity:1;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
}
</style>
<body>
<table><tr><td>
<a href="#">
<span class="panel"><img src="images/2.png" alt="" id="thumb" ></span></a>
</td></tr></table>
</body>
</html>
Demo/example :

Note : Doesn`t work in ie.
Mengganti text font di hover dengan css
HTML (hover.html)
<html>
<head>
<title>Mengganti font</title>
<style type="text/css">
a.textchange span.text1 {
display:inline;
font-family:arial;
}
a.textchange:hover span.text1 {
display:none;
}
a.textchange span.text2 {
display:none;
}
a.textchange:hover span.text2 {
display:inline;
font-family:"times new roman";
}
</style>
</head>
<body>
<a href="#" class="textchange" style="text-decoration:none; color:#555555;"><span class="text1">text pertama dengan font arial dan warna abu - abu</span>
<span class="text2" style="text-decoration:none; color:#ff0000; ">text saat hover dengan font times new roman dan warna merah</span></a>
</body>
</html>
<html>
<head>
<title>Mengganti font</title>
<style type="text/css">
a.textchange span.text1 {
display:inline;
font-family:arial;
}
a.textchange:hover span.text1 {
display:none;
}
a.textchange span.text2 {
display:none;
}
a.textchange:hover span.text2 {
display:inline;
font-family:"times new roman";
}
</style>
</head>
<body>
<a href="#" class="textchange" style="text-decoration:none; color:#555555;"><span class="text1">text pertama dengan font arial dan warna abu - abu</span>
<span class="text2" style="text-decoration:none; color:#ff0000; ">text saat hover dengan font times new roman dan warna merah</span></a>
</body>
</html>
Contoh :
text pertama dengan font arial dan warna abu - abu text saat hover dengan font times new roman dan warna merahCss Smooth Transition
HTML (Css.html)
<html>
<head>
<title>Transition CSS</title>
<style>
#hello {
opacity: 0.3;
-moz-transition-property: opacity;
-moz-transition-duration: 2s;
-moz-transition-delay: 1s;
-webkit-transition-property: opacity;
-webkit-transition-duration: 2s;
-webkit-transition-delay: 1s;
-o-transition-property: opacity;
-o-transition-duration: 2s;
-o-transition-delay: 1s;
transition-property: opacity;
transition-duration: 2s;
transition-delay: 1s;
}
#hello:hover {
opacity: 1;
}
</style>
</head>
<body>
<p id="hello">Hello, CSS lover!</p>
</body>
</html>
<html>
<head>
<title>Transition CSS</title>
<style>
#hello {
opacity: 0.3;
-moz-transition-property: opacity;
-moz-transition-duration: 2s;
-moz-transition-delay: 1s;
-webkit-transition-property: opacity;
-webkit-transition-duration: 2s;
-webkit-transition-delay: 1s;
-o-transition-property: opacity;
-o-transition-duration: 2s;
-o-transition-delay: 1s;
transition-property: opacity;
transition-duration: 2s;
transition-delay: 1s;
}
#hello:hover {
opacity: 1;
}
</style>
</head>
<body>
<p id="hello">Hello, CSS lover!</p>
</body>
</html>
Full Background 100%
CSS (Css.css)
* { margin: 0; padding: 0; }html {
background: url(images/1.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#page-wrap { width: 400px;
margin: 50px auto;
padding: 20px;
background: white;
-moz-box-shadow: 0 0 20px black;
-webkit-box-shadow: 0 0 20px black;
box-shadow: 0 0 20px black;
}
p {
font: 15px/2 Georgia, Serif; margin: 0 0 30px 0;
text-indent: 40px;
}
HTML (full.html)
<html><head>
<title>Full Background 100%</title>
</head>
<body>
<div id="page-wrap">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed porta imperdiet diam at convallis. Praesent gravida, nibh vel eleifend auctor, mauris erat consectetur erat, eget vehicula mauris nulla viverra urna. Suspendisse ultrices felis interdum ante venenatis facilisis. Aenean molestie sagittis vestibulum. Integer pellentesque dolor ac urna sagittis fringilla. Duis rhoncus, est in adipiscing adipiscing, quam justo vulputate quam, nec pharetra est purus a nibh. Sed fermentum sem ut diam venenatis fringilla in ut augue. Nam placerat volutpat enim sit amet tincidunt. Suspendisse pulvinar augue in libero blandit sed scelerisque nulla tempus. Integer viverra tincidunt ornare. Duis et faucibus augue. Nulla elementum porta nibh, in fermentum arcu aliquam nec. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nam quam ligula, fermentum sit amet viverra sit amet, cursus id nibh. Ut pharetra, quam nec vestibulum venenatis, lorem lorem interdum ipsum, sit amet aliquam elit tellus id lorem.
</div>
</body>
</html>
CSS transform
HTML (Transform.html)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
.asli{
width:100px;
height:75px;
background-color:blue;
border:1px solid black;
}
.transform
{
width:100px;
height:75px;
background-color:blue;
border:1px solid black;
transform:rotateY(130deg);
-webkit-transform:rotateY(130deg)
}
</style>
</head>
<body>
Bentuk Asli
<div class="asli">Halo. Ini Bentuk Asli</div>
Hasil Transform
<div class="transform">Halo. Dan ini Hasil Transform</div>
</body>
</html>
Membuat Menu Sederhana dengan CSS
HTML (Menu.html)
<html>
<head>
<style>
.next{
border:none;
border:0px;
margin:0px;
padding:0px;
position:relative;
top:130px;
}
.next ul{
height:55px;
list-style:none;
margin:0;
padding:0;
}
.next li{
float:left;
padding:0px;
}
.next li a{
background:#fff;
color:#ffff00;
font-family:advent;
display:block;
width:50px;
font-weight:normal;
line-height:35px;
padding:15px 30px;
text-align:left;
text-decoration:none;
}
.next li a:hover, .next ul li:hover a{
background:#000;
width:50px;
color:#FFFF99;
text-decoration:none;
}</style>
</head>
<body>
<div class="next"><ul><li><a href="#">NEXT</a></li></ul></div>
</body>
</html>
Langganan:
Postingan (Atom)
