简体   繁体   中英

CSS box in Internet Explorer

I've a rendering problem to show a box with background image and border image in IE8 IE7 IE6

My code works in IE9, Safari, Firefox.

.myBox {
background : url(image-left.gif) left no-repeat,url(image-right.gif) right no-repeat, url(images-center.png) repeat-x;
height: 50px;
position:relative;
}

I've founded a solution to put left and right image in a table:

CSS:

table {
    height: 50px;
    position:relative;
}

.myBox {
    background : url(images-center.png) repeat-x; 
}

html:

<table cellpadding="0" cellspacing="0" border="0">
  <tr>
    <td><img src="image-left.gif" /></td>

    <td>my content text</td>

    <td><img src="image-right.gif" /></td>
</tr>
</table>

Anyone have a better and elegant solution????

Here are two ways to do it

Of-course your method is valid just as well, although it causes you to change your markup..

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