border-radius not working

CssBorder

Css Problem Overview


I'm working on a basic div and for some peculiar reason, border-radius: 7px isn't applying to it.

.panel {
  float: right;
  width: 120px;
  height: auto;
  background: #fff;
  border-radius: 7px; // not working
}

Css Solutions


Solution 1 - Css

To whomever may have this issue. My problem was border-collapse. It was set to:

border-collapse: collapse;

I set it to:

border-collapse: separate; 

and it fixed the issue.

Solution 2 - Css

For anyone who comes across this issue in the future, I had to add

perspective: 1px;

to the element that I was applying the border radius to. Final working code:

.ele-with-border-radius {
    border-radius: 15px;
    overflow: hidden;
    perspective: 1px;
}

Solution 3 - Css

To add a bit on to @ethanmay 's answer: (https://stackoverflow.com/a/44334424/8479303)...

If there are contents within the div that has the curved corners, you have to set overflow: hidden because otherwise the child div's overflow can give the impression that the border-radius isn't working.

<!-- This will look like the border-radius isn't working-->
<div style="border: 1px solid black; border-radius: 10px;">
  <div style="background: red;">
      text!
  </div>
</div>

<!-- but here the contents properly fit within the rounded div -->
<div style="border: 1px solid black; border-radius: 10px; overflow: hidden;">
  <div style="background: red;">
      text!
  </div>
</div>

JSFiddle: http://jsfiddle.net/o2t68exj/

Solution 4 - Css

Im just highlighting part of @Ethan May answer which is

overflow: hidden;

It would most probably do the work for your case.

Solution 5 - Css

For some reason your padding: 7px setting is nullifying the border-radius. Change it to padding: 0px 7px

Solution 6 - Css

in your div class="social-box" css

use

            float:right 

instead of

             float:left

Solution 7 - Css

Try add !important to your css. Its working for me.

.panel {
  float: right;
  width: 120px;
  height: auto;
  background: #fff;
  border-radius: 7px!important;
}

Solution 8 - Css

if you have parent element than your parent element must have overflow: hidden; property because if your children content is getting oveflowed from parent border than your border will be visible .otherwise your borderradius is working but it is hide by your children content.

.outer {
  width: 200px;
  height: 120px;
  border: 1px solid black;
  margin-left: 50px;
  overflow: hidden;
  border-radius: 30px;
}
.inner1 {
  width: 100%;
  height: 100%;
  background-image: linear-gradient(#FF9933,white, green);
  border: 1px solid black;
}

<div class="outer">
  <div class="inner1">
     
  </div>
</div>

Solution 9 - Css

Now I am using the browser kit like this:

{
border-radius: 7px;
-webkit-border-radius: 7px;
-moz-border-radius: 7px;
}

Solution 10 - Css

Your problem is unrelated to how you have set border-radius. Fire up Chrome and hit Ctrl+Shift+j and inspect the element. Uncheck width and the border will have curved corners.

Solution 11 - Css

For my case, I have a dropdown list in my div container, so I can not use overflow: hidden or my dropdown list will be hidden.

Inspired by this discussion: https://twitter.com/siddharthkp/status/1094821277452234752 I use border-bottom-left-radius and border-bottom-right-radius in the child element to fix this issue.

> make sure you add it the correct value for each child separately

enter image description here

Solution 12 - Css

you may include bootstrap to your html file and you put it under the style file so if you do that bootstrap file will override the style file briefly like this

     // style file
     <link rel="stylesheet" href="css/style.css" />
     // bootstrap file
     <link rel="stylesheet" href="css/bootstrap.min.css" />

the right way is this

    // bootstrap file
    <link rel="stylesheet" href="css/bootstrap.min.css" />
    // style file
    <link rel="stylesheet" href="css/style.css" />

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMattView Question on Stackoverflow
Solution 1 - CssRoboYakView Answer on Stackoverflow
Solution 2 - CssEthan MayView Answer on Stackoverflow
Solution 3 - CssjnotelddimView Answer on Stackoverflow
Solution 4 - CssBaldrániView Answer on Stackoverflow
Solution 5 - CssjakeeView Answer on Stackoverflow
Solution 6 - CssUsmanView Answer on Stackoverflow
Solution 7 - CsssyadiqfaliqView Answer on Stackoverflow
Solution 8 - Cssuser9083933View Answer on Stackoverflow
Solution 9 - CssRohit Azad MalikView Answer on Stackoverflow
Solution 10 - CssAlex ChamberlainView Answer on Stackoverflow
Solution 11 - CssTina ChenView Answer on Stackoverflow
Solution 12 - CssMuntadar MuhammadView Answer on Stackoverflow