-
AuthorPosts
-
July 23, 2020 at 1:05 pm #1232584
Hello, I have a question… I changed the iconbox_icon circle into a hexagon with this CSS-Code:
.iconbox_icon{ width: 100px; height: 57.735px; background: #2b7fb9; position: relative; } .iconbox_icon::before { content: ""; position: absolute; top: -28.8675px; left: 0; width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 28.8675px solid #2b7fb9; } .iconbox_icon::after { content: ""; position: absolute; bottom: -28.8675px; left: 0; width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-top: 28.8675px solid #2b7fb9; } .iconbox_icon {border-radius: 0px !important; height: 65px !important; width: 100px !important;} .iconbox_content_title {margin-top: 50px !important;}
Now my problem is, that i can’t see the icons anymore I only can see the hexagon shape and this was it.
How can I fix it?
Thanks, Julian!
July 23, 2020 at 2:23 pm #1232604This will be difficult because the icons are placed in the pseudo container : “:before”
July 23, 2020 at 4:37 pm #1232652Result Page: https://webers-testseite.de/pureinstall/hexagones/
I gave to the icon-box itself a custom-class: hexagone-icons
The trick is to place a div ( div.icon-container) between the before and after container – and to tranfer from the icon-box to that new container a lot of enfold settings. You can now set different colors on the icon-box as before – the will be transfered to the hexagone borders. Even a different icon-set is possible.
this comes to child-theme functions.php :
function add_icon_box_container(){ ?> <script type="text/javascript"> (function($) { $('.iconbox.iconbox_top.hexagone-icons .iconbox_icon').each(function(){ var DataIcon = $(this).data('av_icon'), DataFont = $(this).data('av_iconfont'), IconColor = $(this).css('color'), IconBgColor = $(this).css('background-color'), IconBorder = $(this).css('border'); $(this).append('<div class="icon-container"></div>'); $(this).css('color', IconBgColor); $(this).find('.icon-container').attr({ 'data-av_icon': DataIcon, 'data-av_iconfont': DataFont, }).css({ 'background-color': IconBgColor, 'color': IconColor, }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'add_icon_box_container');
this to quick css
.hexagone-icons .iconbox_icon{ width: 100px; height: 57.735px; background: currentColor; position: absolute; left: 45% !important; border: 1px solid currentColor } .hexagone-icons .iconbox_icon::before { content: ""; position: absolute; top: -28.8675px; left: 0; width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 28.8675px solid currentColor; } .hexagone-icons .iconbox_icon::after { content: ""; position: absolute; bottom: -28.8675px; left: 0; width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-top: 28.8675px solid currentColor; } .hexagone-icons .iconbox_icon {border-radius: 0px !important; height: 30px !important; width: 68px !important;} .hexagone-icons .iconbox_content_title {margin-top: 50px !important;} .hexagone-icons .icon-container { width: 100%; height: 100%; position: relative; } .hexagone-icons .icon-container:before { color: currentColor; content: attr(data-av_icon); font-size: 40px; }
You had to adopt the dimensions of some things! Are there formulars on
July 23, 2020 at 5:23 pm #1232690Hi Guenni007,
Thank you for sharing!
Best regards,
VictoriaJuly 24, 2020 at 10:02 am #1232914Thank you!
July 24, 2020 at 10:52 am #1232922but maybe a different method could be a good alternative.
Browser support is well ( only IE11 and Opera Mini did not support clip-path )this – ( and some posititioning css ) – will work too
.iconbox_icon.heading-color { -webkit-clip-path: polygon(50% 0, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%); clip-path: polygon(50% 0, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%); }
______
mathematically you have to describe a hexagon into the square, and then calculate the coordinate points.you can see here some calculations – ( buf first – that hexagone is different – and second not well calculated ;) )
https://bennettfeely.com/clippy/this is for hexagone different orientation:
.iconbox_icon.heading-color { -webkit-clip-path: polygon(25% 6.7%, 75% 6.7%, 100% 50%, 75% 93.3%, 25% 93.3%, 0% 50%); clip-path: polygon(25% 6.7%, 75% 6.7%, 100% 50%, 75% 93.3%, 25% 93.3%, 0% 50%); }
July 24, 2020 at 3:13 pm #1233021Vielen Dank! Du hast uns damit echt viel geholfen!
July 24, 2020 at 8:51 pm #1233085Hi Julian Post,
Glad you got it working for you with Guenni007’s help! :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- The topic ‘Hexagon Shape in Iconbox’ is closed to new replies.