Web Design Forum: TUTORIAL: Trick to put Optimized round cornerd buttons - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

TUTORIAL: Trick to put Optimized round cornerd buttons Rate Topic: -----

#1 User is offline   Ray Lead 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 64
  • Joined: 27-March 08
  • Reputation: 0
  • Experience:Beginner
  • Area of Expertise:Web Designer

Posted 06 July 2008 - 02:55 PM

Some of us usually put a button with rounded corners on our web pages. We take the whole button as an image and insert it into the page. But if we have many such buttons, then the size of the page is increased a lot. So, here I have a trick by which you can cut small parts of the button and let CSS generate the whole button.

I’ve cut the four small rounded corners into four different images and taken them as a background in four divs and applied certain styles to those divs.

So, the HTML goes like this.

<body>
<div class = "container">
<div class = "cornerbl"><div class = "cornerbr"><div class = "cornertl"><div class = "cornertr">
</div></div></div></div>
</div>
</body>

And the CSS goes like this:

<style type = "text/css">
.container {
width:100px;
height:30px;
background-color: #0c0c0c;
}
.cornerbl {
width:100%; height:100%;
background: url(cornerbl.gif) 0 100% no-repeat;
}
.cornerbr {
width:100%; height:100%;
background: url(cornerbl.gif) 100% 100% no-repeat;
}
.cornertl {
width:100%; height:100%;
background: url(cornerbl.gif) 0 0 no-repeat;
}
.cornertr {
width:100%; height:100%;
background: url(cornerbl.gif) 100% 0 no-repeat;
}
</style>

Source: http://www.designpal....unded-corners/
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users