简体   繁体   中英

jquery's round plugin + border

I wonder how can i get a rounded corner div in IE with borders?

According to jquery plugin jquery.corner.js the job it would be very simple to achieve! But, I can't make a rounded corner div "with border" working in internet explorer greater than 5...

The following code serves only for testing purposes.

<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>somepage</title>

<script type="text/javascript" src="classes/jquery.js"></script>
<script type="text/javascript" src="classes/jquery.corner.js"></script>

<script type="text/javascript">
    $("#teste").corner("round 8px").parent().css('padding', '3px').corner("round 10px");
</script>

<style type="text/css">
.demo{
    height: 34px;
    width: 450px;
    background: blue;
}

</style>

</head>
<body bgcolor="green">

<div id="teste" class="demo">
</div>

</body>
</html>

What am I doing wrong? Many thanks, as always.

您尝试过CSS3PIE吗?

I would recommend that you go with a CSS way to do it.

You go here and select the colors for your corner. http://www.spiffycorners.com/

Once done this will give you the css you need to put and sample code how to use it. It should work very nicely in all browsers. I used it. No images required.

This is sample styles:

<style type="text/css">
.spiffy{display:block}
.spiffy *{
  display:block;
  height:1px;
  overflow:hidden;
  font-size:.01em;
  background:#b20000}
.spiffy1{
  margin-left:3px;
  margin-right:3px;
  padding-left:1px;
  padding-right:1px;
  border-left:1px solid #870000;
  border-right:1px solid #870000;
  background:#9f0000}
.spiffy2{
  margin-left:1px;
  margin-right:1px;
  padding-right:1px;
  padding-left:1px;
  border-left:1px solid #6f0000;
  border-right:1px solid #6f0000;
  background:#a30000}
.spiffy3{
  margin-left:1px;
  margin-right:1px;
  border-left:1px solid #a30000;
  border-right:1px solid #a30000;}
.spiffy4{
  border-left:1px solid #870000;
  border-right:1px solid #870000}
.spiffy5{
  border-left:1px solid #9f0000;
  border-right:1px solid #9f0000}
.spiffyfg{
  background:#b20000}
</style>

This is how to use it:

<div>
  <b class="spiffy">
  <b class="spiffy1"><b></b></b>
  <b class="spiffy2"><b></b></b>
  <b class="spiffy3"></b>
  <b class="spiffy4"></b>
  <b class="spiffy5"></b></b>

  <div class="spiffyfg">
    <!-- content goes here -->
  </div>

  <b class="spiffy">
  <b class="spiffy5"></b>
  <b class="spiffy4"></b>
  <b class="spiffy3"></b>
  <b class="spiffy2"><b></b></b>
  <b class="spiffy1"><b></b></b></b>
</div>

Happy styling!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM