Rounded border without border-radius

2019-08-04 03:55发布

问题:

I'm developing a website using with HTML4, CSS2. so I can't use border-radius property. How can I create <div> or <table> what has rounded border?

Thank you in advance.

回答1:

Found something related. Reference - LINK

.b1,
.b2,
.b3,
.b4 {
  font-size: 1px;
  overflow: hidden;
  display: block;
}

.b1 {
  height: 1px;
  background: #888;
  margin: 0 5px;
}

.b2 {
  height: 1px;
  border-right: 2px solid #888;
  border-left: 2px solid #888;
  margin: 0 3px;
}

.b3 {
  height: 1px;
  border-right: 1px solid #888;
  border-left: 1px solid #888;
  margin: 0 2px;
}

.b4 {
  height: 2px;
  border-right: 1px solid #888;
  border-left: 1px solid #888;
  margin: 0 1px;
}

.contentb {
  border-right: 1px solid #888;
  border-left: 1px solid #888;
}

.contentb div {
  margin-left: 5px;
}
<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="contentb">
  <div>Round Border!!</div>
</div>
<b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b>



回答2:

The only way I can think of is some svg hacky method, for example:

<svg width="500" height="400">
  <path d="M50,25 h300 a20,20 0 0 1 20,20 v200 a20,20 0 0 1 -20,20 h-300 a20,20 0 0 1 -20,-20 v-200 a20,20 0 0 1 20,-20 z" fill="none" stroke="#0089cc" stroke-width="2" />
</svg>

or you could create a transparent image in Photoshop/GIMP that has a border with rounded edges. Then, you could just use CSS background-image filepath URL to whatever div you'd like to target.



回答3:

//realized that you're using css2

/*Your Id/class*/
div {
  border: 2px solid black;
  border-radius: 25px 50px 10px 23px;
}

Use border: to create the border first, then use border-radius to specify the radius.

You can enter multiple values to specify each edge. The patterns of the values are: top-left top-right bottom-left bottom-right

You can also specify only one two or three values. Here is the pattern:

  • Four values: first value applies to top-left, second value applies to top-right, third value applies to bottom-right, and fourth value applies to bottom-left corner

  • Three values: first value applies to top-left, second value applies to top-right and bottom-left, and third value applies to bottom-right

  • Two values: first value applies to top-left and bottom-right corner, and the second value applies to top-right and bottom-left corner

  • One value: all four corners are rounded equally



回答4:

  #header {
            float: left;
            width: 100%;
            font-size: 93%;
            line-height: normal;
        }
        
        #header ul {
            margin: 0;
            padding: 0;
            list-style: none;
        }
        
        #header li {
            float: left;
            background: url("https://image.ibb.co/kPAMhv/norm_right.gif") no-repeat right top;
            margin: 0;
            padding: 0;
        }
        
        #header a {
            display: block;
            background: url("https://image.ibb.co/f01GFF/norm_left.gif") no-repeat left top;
            padding: 5px 15px;
        }
  <div id="header">
        <ul>
            <li><a href="#">Link1</a></li>
            <li><a href="#">Link2</a></li>
            <li><a href="#">Link3</a></li>
        </ul>
    </div>



标签: html css web html4