CSS adding border radius to an IFrame

前端 未结 11 797
南旧
南旧 2020-12-31 05:50

Adding a border to an IFrame is no biggie - you do it like this e.g.:

  border: 4px solid #000;
  -moz-border-radius: 15px;
  border-radius: 15px;


        
相关标签:
11条回答
  • 2020-12-31 06:31

    Border radius isn't well supported or consistent yet. If you want the desired affect, try using DIV's around the element and use graphics instead, with an overflow of hidden in your CSS. You might want to look into the sliding doors tehnique if your iframe varies in height.

    http://www.alistapart.com/articles/slidingdoors/

    Hope this helps.

    Good luck!

    0 讨论(0)
  • 2020-12-31 06:34

    You miss overflow and position properties. This should work:

        border: 4px solid #000;
        -moz-border-radius: 15px;
        border-radius: 15px;
        overflow: hidden;
        position: relative;
    
    0 讨论(0)
  • 2020-12-31 06:35

    The box-shadow will round corners. Just have a spread-distance of the thickness of your border and a blur value of 0. This is a hack, but what isn't in HTML?

    box-shadow: 0 0 0 1px #000;
    

    Will add a 1 pixel border. The first two zeros are the offset. The third zero is how much blur you want to give to the shadow (none). The 1px is how far "out" you want the shadow to go. The last parameter is the color of the border. Most people omit the spread because they want their shadows to be the same size as the element.

    Here is an example where I did this, which works in at least IE9 and Chrome 17: http://www.philihp.com/blog/2012/i-made-a-gps-locator-for-myself/

    0 讨论(0)
  • 2020-12-31 06:35

    In case you haven't figured this out yet, try this...works for me:

    I have noticed that if you try to do this externall even to the tag, it doesn't work. Set style within the iframe tag.

    Good Luck!

    0 讨论(0)
  • 2020-12-31 06:41

    You could use the Malsap jQuery rouned corner plugin. It won't fix the actual problem, but it will give you the rounded corners without the issue.

    0 讨论(0)
提交回复
热议问题