CSS3: Bone shape

匆匆过客 提交于 2019-12-11 10:37:10

问题


How to make a grid with dog bone format in CSS and/or jQuery? The format of bone is this:

And the grid would look like this, just that out instead of hexagonal and the content (image/text) inside format would bone:

It is possible to create this format?


回答1:


Here's how you draw bone.

Demo

HTML

<div class="bone">
    <div class="s1"></div>
    <div class="s2"></div>
    <div class="s3"></div>
    <div class="s4"></div>
    <div class="centerbone">
      <div class="clean"></div>
    </div>
</div>

CSS

.bone{
  position: relative;
  width: 600px;
}
.s1, .s2, .s3, .s4{
  background:#fff;
  height: 200px;
  width: 200px;
  border: 5px solid #000;
  border-radius: 200px;
  position:absolute;
}
.s1{
  left: 0;
}
.s2{
  right: 0;
}
.s3{
  top: 205px;
}
.s4{
  right: 0;
  top:205px;
}
.centerbone{
  background:#fff;
  height: 250px;
  width: 188px;
  border: 5px solid #000;
  position:absolute;  
  left: 205px;
  top: 78px;
  border-width: 5px 0 5px;
}
.clean{
  background:#fff;
  width: 400px;
  height:100%;
  position: absolute;
  left:-104px;
}

And for hexagon grid, follow this tutorial:

http://jtauber.github.io/articles/css-hexagon.html



来源:https://stackoverflow.com/questions/17004554/css3-bone-shape

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!