Z
Z
zayko2012-12-02 21:18:19
css
zayko, 2012-12-02 21:18:19

Has anyone seen the implementation of a hexagon ("honeycomb") in html + css?

No, I won't trade honey =)

I decided to implement several rows of combs fitted to each other. Like bee hives.

It would be great if someone suggested an example of the implementation of such a thing in pure css + html. Maybe someone saw something similar?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
anathem, 2012-12-02
@anathem

css-tricks.com/examples/ShapesOfCSS/

#hexagon {
  width: 100px;
  height: 55px;
  background: red;
  position: relative;
}
#hexagon:before {
  content: "";
  position: absolute;
  top: -25px;
  left: 0;
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-bottom: 25px solid red;
}
#hexagon:after {
  content: "";
  position: absolute;
  bottom: -25px;
  left: 0;
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-top: 25px solid red;
}

S
Softlink, 2012-12-02
@Softlink

Roma Komarov has, in my opinion, what you need .

Z
zayko, 2012-12-02
@zayko

In general, yes. Seem to be. The ambush is that I will need to show a picture inside the cell + they will go in rows. But yes, there is a foundation. Thank you!

O
omcg, 2014-10-28
@omcg

This is more correct. The size of the hexagon is changed by 1 value - font-size. True color changes on hover 2 (

#hexagon {
    font-size: 20px;
    width: 1em;
    height: 0.58em;
    background: #fff;
    color: #fff;
    display: block;
    position: relative;
}

#hexagon:before {
    content: "";
    position: absolute;
    top: -0.25em;
    left: 0;
    width: 0;
    height: 0;
    border-color: inherit;
    border-left: 0.5em solid transparent;
    border-right: 0.5em solid transparent;
    border-bottom: 0.25em solid
}

#hexagon:after {
    content: "";
    position: absolute;
    bottom: -0.25em;
    left: 0;
    width: 0;
    height: 0;
    border-color: inherit;
    border-left: 0.5em solid transparent;
    border-right: 0.5em solid transparent;
    border-top: 0.25em solid;
}

#hexagon:hover {
    background-color: #FFC500;
    color: #FFC500;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question