常规方法

用2个div

  1. <div class="something-meaningful"><div>
  2. I have a nice subtle inner rounding,
  3. don't I look pretty?
  4. </div></div>
  5. .something-meaningful {
  6. background: #655;
  7. padding: .8em;
  8. }
  9. .something-meaningful > div {
  10. background: tan;
  11. border-radius: .8em;
  12. padding: 1em;
  13. }

outline + box-shadow

outline不会贴合圆角
box-shadow填补圆角

  1. outline: .6em solid #655;
  2. border-radius: .8em;
  3. box-shadow: 0 0 0 .4em #655; /* todo calculate max of this */
  4. background: tan;

image.png