Mengganti Tampilan Judul Blog
Mengganti Tampilan Judul Blog dengan CSS dan jQuery
by Arlina Fitriyani
HTML
<h3><a href='http://twistedshape.blogspot.com/2015/01/mengganti-tampilan-judul-blog.html' target="_blank"> Kembali ke artikel </a></h3>
<div class='clear'/>
<div class='container'>
<div class='header'>
<div class='header-inner'><h1 class='title'>Header Title</h1>
</div>
</div>
CSS
@import url(http://fonts.googleapis.com/css?family=Roboto+Slab:400,700);
body,ul {
margin: 0 0 0 0;
padding: 0 0 0 0;
list-style: none;
background: #f0f0f0;
}
h3 {
font-family: 'Roboto Slab',sans-serif;
font-size: 18px;
font-weight: 400;
text-align: center;
padding: 10px;
margin: 15px auto;
background: #2ba6e1;
border-bottom: 2px solid #2289bb;
border-radius: 3px 3px 5px 5px;
color: #fff;
width: 200px;
box-shadow: 0 0 3px #e0e0e0;
margin: 20px auto;
text-align: center;
transition: all 0.5s ease-in-out;
}
h3 a {
color: #fff;
text-decoration: none;
}
h3:hover {
background: #3eb2ea;
}
.container {
background: transparent;
margin: 0 0 0 0;
padding: 0 0 0 0;
list-style: none;
text-align: center;
}
.header {
width: auto;
display: inline-block;
position: relative;
z-index: 5;
margin: 50px auto;
}
.header-inner {
padding: 20px;
display: inline-block;
width: 100%;
background: #fff;
box-shadow: 0 2px 0 #e9e9e9;
border-radius: 2px 2px 4px 4px;
}
.header h1 {
font-weight: 400;
font-size: 75px;
font-family: 'Roboto Slab',sans-serif;
text-transform: uppercase;
margin: 0;
width: 100%;
float: left;
color: #666;
}
.headerword2 {
background: #f35d5c;
color: #fff;
padding-left: 10px;
padding-right: 10px;
}
JavaScript
(function(e){e(".title,.widget-title").each(function(){var e=jQuery(this);e.html(e.html().replace(/^(\w+)/,"<span>$1</span>"))});e("h1.title").each(function(){var t=e(this).text().split(" ");if(t.length<2)return;t[0]='<span class="headerword2"><span class="headerword">'+t[0]+"</span></span>";e(this).html(t.join(" "))})})(jQuery)