Beautiful Navigation Knob (Need 3 buttons) - html
Beautiful Navigation Knob
I want to use this awesome CSS work, but I can't figure out how to change it from 6 buttons to 3 buttons only.
Original:
https://codepen.io/ademilter/pen/Dwelk
My try:
https://codepen.io/shellx3/pen/KKyKaKM
.den #switch_1:checked ~ .light {
-moz-transform: rotate(-30deg);
-webkit-transform: rotate(-30deg);
-o-transform: rotate(-30deg);
}
Just played with deg to get this. https://codepen.io/Sreehariavikkal/pen/mdqdWWR Please try inspecting and changing according to your need.
<div class="container">
<!-- OUTER SHADOW -->
<div class="de">
<!-- TEXT -->
<div class="den">
<!-- LINE -->
<hr class="line">
<hr class="line">
<!-- SWITCH -->
<div class="switch">
<!-- TEXT -->
<label for="switch_off"><span>OFF</span></label>
<label for="switch_1"><span>1</span></label>
<label for="switch_2"><span>2</span></label>
<label for="switch_3"><span>3</span></label>
<!-- <label for="switch_4"><span>4</span></label>
<label for="switch_5"><span>5</span></label> -->
<!-- INPUT -->
<input id="switch_off" name="switch" checked type="radio">
<input id="switch_1" name="switch" type="radio">
<input id="switch_2" name="switch" type="radio">
<input id="switch_3" name="switch" type="radio">
<!-- <input id="switch_4" name="switch" type="radio">
<input id="switch_5" name="switch" type="radio"> -->
<!-- LIGHT -->
<div class="light"><span></span></div>
<!-- DOT -->
<div class="dot"><span></span></div>
<!-- CENTER -->
<div class="dene">
<div class="denem">
<div class="deneme">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
/* MASTER
--------------------------------------------- */
html, body {
height: 100%;
}
body {
font-family: Helvetica, Arial, sans-serif;
color: #333;
font-size: 13px;
background: #fefefe;
background: -moz-linear-gradient(top, #fefefe 0%, #dbe5e7 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fefefe), color-stop(100%, #dbe5e7));
background: -webkit-linear-gradient(top, #fefefe 0%, #dbe5e7 100%);
background: -o-linear-gradient(top, #fefefe 0%, #dbe5e7 100%);
background-attachment: fixed;
}
/* SWITCH
--------------------------------------------- */
.container {
width: 230px;
width: 230px;
margin: 40px auto 0;
}
.container .origin {
position: absolute;
left: 50%;
top: 50%;
z-index: 111;
width: 2px;
height: 2px;
margin: -1px 0 0 -1px;
background-color: #f50;
}
.de {
-webkit-user-select: none;
position: relative;
width: 230px;
height: 230px;
border-radius: 100%;
box-shadow: 0 0 25px rgba(0, 0, 0, .1);
background-color: transparent;
}
.de .den, .de .dene, .de .denem, .de .deneme, .de .light, .de .dot {
position: absolute;
left: 50%;
top: 50%;
}
.den {
position: relative;
width: 220px;
height: 220px;
margin: -110px 0 0 -110px;
border-radius: 100%;
box-shadow: inset 0 3px 10px rgba(0, 0, 0, .6), 0 2px 20px rgba(255, 255, 255, 1);
background: #888888;
background: -moz-radial-gradient(center, ellipse cover, #888888 0%, #333333 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, #888888), color-stop(100%, #333333));
background: -webkit-radial-gradient(center, ellipse cover, #888888 0%, #333333 100%);
background: -o-radial-gradient(center, ellipse cover, #888888 0%, #333333 100%);
}
.dene {
z-index: 4;
width: 140px;
height: 140px;
margin: -70px 0 0 -70px;
border-radius: 100%;
box-shadow: inset 0 2px 2px rgba(255, 255, 255, .4), 0 3px 13px rgba(0, 0, 0, .85);
background: #f2f6f5;
background: -moz-linear-gradient(top, #f2f6f5 0%, #cbd5d6 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f2f6f5), color-stop(100%, #cbd5d6));
background: -webkit-linear-gradient(top, #f2f6f5 0%, #cbd5d6 100%);
background: -o-linear-gradient(top, #f2f6f5 0%, #cbd5d6 100%);
}
.denem {
width: 120px;
height: 120px;
margin: -60px 0 0 -60px;
border-radius: 100%;
background: #cbd5d6;
background: -moz-linear-gradient(top, #cbd5d6 0%, #f2f6f5 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #cbd5d6), color-stop(100%, #f2f6f5));
background: -webkit-linear-gradient(top, #cbd5d6 0%, #f2f6f5 100%);
background: -o-linear-gradient(top, #cbd5d6 0%, #f2f6f5 100%);
}
.deneme {
width: 100px;
height: 100px;
margin: -50px 0 0 -50px;
border-radius: 100%;
box-shadow: inset 0 2px 3px rgba(255, 255, 255, .6), 0 8px 20px rgba(0, 0, 0, .9);
background: #eef7f6;
background: -moz-linear-gradient(top, #eef7f6 0%, #8d989a 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #eef7f6), color-stop(100%, #8d989a));
background: -webkit-linear-gradient(top, #eef7f6 0%, #8d989a 100%);
background: -o-linear-gradient(top, #eef7f6 0%, #8d989a 100%);
}
.den .switch {
z-index: 3;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.den .switch label {
z-index: 2;
position: absolute;
top: 50%;
left: 50%;
width: 50%;
height: 70px;
margin-top: -35px;
-moz-transform-origin: 0% 50%;
-webkit-transform-origin: 0% 50%;
-o-transform-origin: 0% 50%;
}
.den .switch label:after {
content: "";
position: absolute;
top: 6px;
left: 1px;
width: 100%;
height: 30px;
-moz-transform: rotate(-30deg);
-webkit-transform: rotate(-30deg);
-o-transform: rotate(-30deg);
}
.den .switch label:before {
content: "";
position: absolute;
bottom: 6px;
left: 1px;
width: 100%;
height: 30px;
-moz-transform: rotate(30deg);
-webkit-transform: rotate(30deg);
-o-transform: rotate(30deg);
}
.den .switch label span {
z-index: 2;
position: absolute;
top: 0;
right: 0;
width: 40px;
height: 100%;
font-weight: bold;
font-size: 15px;
line-height: 70px;
text-align: center;
color: #eee;
text-shadow: 0 1px 0 #444;
}
.den .switch label:nth-child(1) {
-moz-transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
}
.den .switch label:nth-child(1) span {
right: 2px;
font-size: 13px;
-moz-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-o-transform: rotate(90deg);
}
.den .switch label:nth-child(2) {
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-o-transform: rotate(360deg);
}
.den .switch label:nth-child(2) span {
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-o-transform: rotate(360deg);
}
.den .switch label:nth-child(3) {
-moz-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-o-transform: rotate(90deg);
}
.den .switch label:nth-child(3) span {
-moz-transform: rotate(270deg);
-webkit-transform: rotate(270deg);
-o-transform: rotate(270deg);
}
.den .switch label:nth-child(4) {
-moz-transform: rotate(180deg);
-webkit-transform: rotate(180deg);
-o-transform: rotate(180deg);
}
.den .switch label:nth-child(4) span {
-moz-transform: rotate(180deg);
-webkit-transform: rotate(180deg);
-o-transform: rotate(180deg);
}
.den .switch label:nth-child(5) {
-moz-transform: rotate(150deg);
-webkit-transform: rotate(150deg);
-o-transform: rotate(150deg);
}
.den .switch label:nth-child(5) span {
-moz-transform: rotate(-150deg);
-webkit-transform: rotate(-150deg);
-o-transform: rotate(-150deg);
}
.den .switch label:nth-child(6) {
-moz-transform: rotate(210deg);
-webkit-transform: rotate(210deg);
-o-transform: rotate(210deg);
}
.den .switch label:nth-child(6) span {
-moz-transform: rotate(-210deg);
-webkit-transform: rotate(-210deg);
-o-transform: rotate(-210deg);
}
.den .switch input {
position: absolute;
opacity: 0;
visibility: hidden;
}
/* SWITCH LIGHT */
.den .light {
z-index: 1;
width: 50%;
height: 100px;
margin-top: -50px;
-moz-transform-origin: 0% 50%;
-webkit-transform-origin: 0% 50%;
-o-transform-origin: 0% 50%;
-moz-transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-webkit-transition: all .5s;
-moz-transition: all .5s;
-o-transition: all .5s;
}
.den .light span {
opacity: .4;
position: absolute;
top: 0;
left: 15px;
width: 100px;
height: 100px;
background: -moz-radial-gradient(center, ellipse cover, rgba(184, 163, 204, 1) 0%, rgba(159, 197, 224, 0.42) 42%, rgba(111, 113, 179, 0) 72%, rgba(67, 34, 137, 0) 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, rgba(184, 163, 204, 1)), color-stop(42%, rgba(159, 197, 224, 0.42)), color-stop(72%, rgba(111, 113, 179, 0)), color-stop(100%, rgba(67, 34, 137, 0)));
background: -webkit-radial-gradient(center, ellipse cover, rgba(184, 163, 204, 1) 0%, rgba(159, 197, 224, 0.42) 42%, rgba(111, 113, 179, 0) 72%, rgba(67, 34, 137, 0) 100%);
background: -o-radial-gradient(center, ellipse cover, rgba(184, 163, 204, 1) 0%, rgba(159, 197, 224, 0.42) 42%, rgba(111, 113, 179, 0) 72%, rgba(67, 34, 137, 0) 100%);
}
/* SWITCH LIGHT POSITION */
.den #switch_off:checked ~ .light {
-moz-transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
}
.den #switch_1:checked ~ .light {
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
}
.den #switch_2:checked ~ .light {
-moz-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-o-transform: rotate(90deg);
}
.den #switch_3:checked ~ .light {
-moz-transform: rotate(180deg);
-webkit-transform: rotate(180deg);
-o-transform: rotate(180deg);
}
/* SWITCH LIGHT */
.den .dot {
z-index: 6;
width: 50%;
height: 12px;
margin-top: -6px;
-moz-transform-origin: 0% 50%;
-webkit-transform-origin: 0% 50%;
-o-transform-origin: 0% 50%;
-webkit-transition: all .5s;
-moz-transition: all .5s;
-o-transition: all .5s;
}
.den .dot span {
position: absolute;
top: 0;
left: 30px;
width: 12px;
height: 12px;
border-radius: 100%;
background: #dae2e4;
background: -moz-linear-gradient(top, #dae2e4 0%, #ecf5f4 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #dae2e4), color-stop(100%, #ecf5f4));
background: -webkit-linear-gradient(top, #dae2e4 0%, #ecf5f4 100%);
background: -o-linear-gradient(top, #dae2e4 0%, #ecf5f4 100%);
}
/* SWITCH LIGHT POSITION */
.den #switch_off:checked ~ .dot {
-moz-transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
}
.den #switch_off:checked ~ .dot span {
-moz-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-o-transform: rotate(90deg);
}
.den #switch_1:checked ~ .dot {
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
}
.den #switch_1:checked ~ .dot span {
opacity: .9;
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
}
.den #switch_2:checked ~ .dot {
-moz-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-o-transform: rotate(90deg);
}
.den #switch_2:checked ~ .dot span {
opacity: .5;
-moz-transform: rotate(-30deg);
-webkit-transform: rotate(-30deg);
-o-transform: rotate(-30deg);
}
.den #switch_3:checked ~ .dot {
-moz-transform: rotate(180deg);
-webkit-transform: rotate(180deg);
-o-transform: rotate(180deg);
}
.den #switch_3:checked ~ .dot span {
opacity: .4;
-moz-transform: rotate(180deg);
-webkit-transform: rotate(180deg);
-o-transform: rotate(180deg);
}
/* LINE */
.den hr.line {
z-index: 1;
position: absolute;
top: 50%;
width: 100%;
height: 0;
margin-top: -1px;
border-width: 1px 0;
border-style: solid;
border-top-color: #3c3d3f;
border-bottom-color: #666769;
}
.den hr.line:nth-child(1) {
-moz-transform: rotate(-210deg);
-webkit-transform: rotate(-210deg);
-o-transform: rotate(-210deg);
}
.den hr.line:nth-child(2) {
-moz-transform: rotate(210deg);
-webkit-transform: rotate(210deg);
-o-transform: rotate(210deg);
}
Related
Background color not visible in Safari
.chevron { position: relative; text-align: center; padding: 12px; margin-bottom: 6px; } .chevron:before { content: ''; position: absolute; top: 40px; left: 0; height: 100%; width: 60%; background-color: rgb(9, 73, 131); background-color: rgba(9, 73, 131, 1); transform: skew(0deg, 6deg); -webkit-transform: skew(0deg, 6deg); -moz-transform: skew(0deg, 6deg); -ms-transform: skew(0deg, 6deg); -o-transform: skew(0deg, 6deg); } .chevron:after { content: ''; position: absolute; top: 40px; right: 0; height: 100%; width: 60%; background-color: rgb(9, 73, 131); background-color: rgba(9, 73, 131, 1); transform: skew(0deg, -6deg); -webkit-transform: skew(0deg, -6deg); -moz-transform: skew(0deg, -6deg); -ms-transform: skew(0deg, -6deg); -o-transform: skew(0deg, -6deg); } I have a Wordpress Project where I have added a Background color. The Background color work fine with all the browsers except Safari. I have tried multiple approaches like giving rgb(For Old Browsers) rgba(For Latest Browsers) but it is still not visible.
Try the below CSS for safari browser. _::-webkit-full-page-media, _:future, :root .chevron:before{ background-color: rgb(9, 73, 131); } _::-webkit-full-page-media, _:future, :root .chevron:after{ background-color: rgb(9, 73, 131); }
CSS Transform RotateX not working in IE11
I have a "promo roller" which is uses CSS animation to rotate a cube, showing only one of the four sides of the cube at any give time. The rotation of the cube shows the next side. /*-- Animated Promo Roller --*/ #roller { width: 140px; height: 28px; position: absolute; } .face1, .face2, .face3, .face4 { font-size: 16px; line-height: 28px; font-weight: bold; color: #fff; text-align: center; width: 140px; height: 28px; margin: -8px 0px 10px 157px; position: absolute; background: #d71e44; /* Old browsers */ background: -moz-linear-gradient(top, #d71e44 0%, #c11e44 100%); /* FF3.6+ */ background: -moz-gradient(linear, left top, left bottom, color-stop(0%,#d71e44), color-stop(100%,#c11e44)); /* Chrome,Safari4+ */ background: -moz-linear-gradient(top, #d71e44 0%,#c11e44 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #d71e44 0%,#c11e44 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, #d71e44 0%,#c11e44 100%); /* IE10+ */ background: linear-gradient(to bottom, #d71e44 0%,#c11e44 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d71e44', endColorstr='#c11e44',GradientType=0 ); /* IE6-9 */ } #roller .face1 { transform: translateZ(14px); } #roller .face2 { transform: rotateX(90deg) translateZ(14px); } #roller .face3 { transform: rotateX(180deg) translateZ(14px); } #roller .face4 { transform: rotateX(270deg) translateZ(14px); } #keyframes spincube { from,to { } 0% { transform: rotateX(0deg); } 14% { transform: rotateX(0deg); } 21% { transform: rotateX(-90deg); } 35% { transform: rotateX(-90deg); } 42% { transform: rotateX(-180deg); } 70% { transform: rotateX(-180deg); } 77% { transform: rotateX(-270deg); } 91% { transform: rotateX(-270deg); } 100% { transform: rotateX(-360deg); } } #roller { animation-name: spincube; animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-duration: 12s; transform-style: preserve-3d; transform-origin: 7px 7px 0; } <div id="roller"> <div class="face1">WAS R242,900</div> <div class="face2">NOW R227,900</div> <div class="face3">SAVE R15,000</div> <div class="face4">ON PROMO</div> </div> The code works perfectly except in Internet Explorer (currently test with IE11), in IE11 the rotational animation works fine. But the transform rotateX and translateZ used to create the cube does not work. So only side of the cube is visible, the other 3 sides are hidden behind it. Can this be made to work in IE11? Kind regards Willem
Better late than never: IE doesn't support transform-style, see also for example this question (I'm sure there are more than this, but this was the one I found) You could try to create some css for an effect like this with only 2 sides. With mediaqueries it should be possible to target IE11 only, so you could hide this 3d animation for IE and only show this two sided animation for IE users. Not ideal but better than nothing. I created a fiddle by copy pasting the code from David Walsh's site, he did a really great work by creating this. /* simple */ .flip-container { -webkit-perspective: 1000; -moz-perspective: 1000; -ms-perspective: 1000; perspective: 1000; -ms-transform: perspective(1000px); -moz-transform: perspective(1000px); -moz-transform-style: preserve-3d; -ms-transform-style: preserve-3d; border: 1px solid #ccc; } /* .flip-container:hover .flipper, .flip-container.hover .flipper, #flip-toggle.flip .flipper { -webkit-transform: rotateY(180deg); -moz-transform: rotateY(180deg); -ms-transform: rotateY(180deg); transform: rotateY(180deg); filter: FlipH; -ms-filter: "FlipH"; } */ /* START: Accommodating for IE */ .flip-container:hover .back, .flip-container.hover .back { -webkit-transform: rotateY(0deg); -moz-transform: rotateY(0deg); -o-transform: rotateY(0deg); -ms-transform: rotateY(0deg); transform: rotateY(0deg); } .flip-container:hover .front, .flip-container.hover .front { -webkit-transform: rotateY(180deg); -moz-transform: rotateY(180deg); -o-transform: rotateY(180deg); transform: rotateY(180deg); } /* END: Accommodating for IE */ .flip-container, .front, .back { width: 320px; height: 427px; } .flipper { -webkit-transition: 0.6s; -webkit-transform-style: preserve-3d; -ms-transition: 0.6s; -moz-transition: 0.6s; -moz-transform: perspective(1000px); -moz-transform-style: preserve-3d; -ms-transform-style: preserve-3d; transition: 0.6s; transform-style: preserve-3d; position: relative; } .front, .back { -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; -ms-backface-visibility: hidden; backface-visibility: hidden; -webkit-transition: 0.6s; -webkit-transform-style: preserve-3d; -webkit-transform: rotateY(0deg); -moz-transition: 0.6s; -moz-transform-style: preserve-3d; -moz-transform: rotateY(0deg); -o-transition: 0.6s; -o-transform-style: preserve-3d; -o-transform: rotateY(0deg); -ms-transition: 0.6s; -ms-transform-style: preserve-3d; -ms-transform: rotateY(0deg); transition: 0.6s; transform-style: preserve-3d; transform: rotateY(0deg); position: absolute; top: 0; left: 0; } .front { -webkit-transform: rotateY(0deg); -ms-transform: rotateY(0deg); background: lightgreen; z-index: 2; } .back { background: lightblue; -webkit-transform: rotateY(-180deg); -moz-transform: rotateY(-180deg); -o-transform: rotateY(-180deg); -ms-transform: rotateY(-180deg); transform: rotateY(-180deg); } .front .name { font-size: 2em; display: inline-block; background: rgba(33, 33, 33, 0.9); color: #f8f8f8; font-family: Courier; padding: 5px 10px; border-radius: 5px; bottom: 60px; left: 25%; position: absolute; text-shadow: 0.1em 0.1em 0.05em #333; display: none; -webkit-transform: rotate(-20deg); -moz-transform: rotate(-20deg); -ms-transform: rotate(-20deg); transform: rotate(-20deg); } .back-logo { position: absolute; top: 40px; left: 90px; width: 160px; height: 117px; background: url(logo.png) 0 0 no-repeat; } .back-title { font-weight: bold; color: #00304a; position: absolute; top: 180px; left: 0; right: 0; text-align: center; text-shadow: 0.1em 0.1em 0.05em #acd7e5; font-family: Courier; font-size: 22px; } .back p { position: absolute; bottom: 40px; left: 0; right: 0; text-align: center; padding: 0 20px; font-size: 18px; } /* vertical */ .vertical.flip-container { position: relative; } .vertical .back { -webkit-transform: rotateX(180deg); -moz-transform: rotateX(180deg); -ms-transform: rotateX(180deg); transform: rotateX(180deg); } .vertical.flip-container .flipper { -webkit-transform-origin: 100% 213.5px; -moz-transform-origin: 100% 213.5px; -ms-transform-origin: 100% 213.5px; transform-origin: 100% 213.5px; } /* .vertical.flip-container:hover .flipper { -webkit-transform: rotateX(-180deg); -moz-transform: rotateX(-180deg); -ms-transform: rotateX(-180deg); transform: rotateX(-180deg); } */ /* START: Accommodating for IE */ .vertical.flip-container:hover .back, .vertical.flip-container.hover .back { -webkit-transform: rotateX(0deg); -moz-transform: rotateX(0deg); -o-transform: rotateX(0deg); -ms-transform: rotateX(0deg); transform: rotateX(0deg); } .vertical.flip-container:hover .front, .vertical.flip-container.hover .front { -webkit-transform: rotateX(180deg); -moz-transform: rotateX(180deg); -o-transform: rotateX(180deg); transform: rotateX(180deg); } /* END: Accommodating for IE */ <div class="flip-container vertical" ontouchstart="this.classList.toggle('hover');"> <div class="flipper"> <div class="front" style='background: #adadad no-repeat 0px 0px;'> <span class="name">David Walsh</span> </div> <div class="back" style="background: rgb(248, 248, 248);"> <div class="back-logo"></div> <div class="back-title">#davidwalshblog</div> <p>Mozilla Web Developer, MooTools & jQuery Consultant, MooTools Core Developer, Javascript Fanatic, CSS Tinkerer, PHP Hacker, and web lover.</p> </div> </div> </div>
CSS Diamond / Triangle shaped divider line / border
I have the following gold dividing line I'm trying to create in pure CSS. I'm trying to create this with the transform:scale; CSS So far I have found the following: .border_angle { border: 50vw solid transparent; width: 0; height: 0; border-bottom-color: transparent; border-left-color: transparent; border-top-color: transparent; transform: scaleY(0.105) translateY(-50%); -webkit-transform: scaleY(0.105) translateY(-50%); -o-transform: scaleY(0.105) translateY(-50%); -moz-transform: scaleY(0.105) translateY(-50%); -ms-transform: scaleY(0.105) translateY(-50%); position: absolute; transform-origin: top center; top: 0; left: 0; right: 0; z-index: 11; } .border_angle_gold_l { border-left-color: #BE955A; } .border_angle_gold-light_r { border-right-color: #CCA56B; } <div style="margin-top: 200px;" class="border_angle border_angle_gold_l border_angle_gold-light_r"></div> Essentially, I nearly have it but I just need to reverse the triangles!! I can't figure out how... Any help would be massively appreciated.
I would do this differently with less of code and linear-gradient: .triangle { margin-top:100px; height:80px; background-image: linear-gradient(to bottom right, transparent 50%,#BE955A 51%), linear-gradient(to top right, transparent 50%,#BE955A 51%), linear-gradient(to bottom left, transparent 50%,#CCA56B 51%), linear-gradient(to top left, transparent 50%,#CCA56B 51%); background-position:0 0,0 100%,100% 0,100% 100%; background-size:50.3% 50%; background-repeat:no-repeat; } <div class="triangle"> </div> Here is another idea using clip-path: .triangle { margin-top: 100px; height: 80px; background: linear-gradient(to left, #CCA56B 50%, #BE955A 0); -webkit-clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); } <div class="triangle"> </div>
You could try duplicating the div and then adding translateX like: .border_angle { border: 50vw solid transparent; width: 0; height: 0; border-bottom-color: transparent; border-left-color: transparent; border-top-color: transparent; position: absolute; transform-origin: top center; top: 0; left: 0; right: 0; z-index: 11; } .border_angle_gold_l { border-left-color: #BE955A; } .border_angle_gold-light_r { border-right-color: #CCA56B; } .first { transform: scaleY(0.105) translateY(-50%) translateX(50%); -webkit-transform: scaleY(0.105) translateY(-50%) translateX(50%); -o-transform: scaleY(0.105) translateY(-50%) translateX(50%); -moz-transform: scaleY(0.105) translateY(-50%) translateX(50%); -ms-transform: scaleY(0.105) translateY(-50%) translateX(50%); } .second { transform: scaleY(0.105) translateY(-50%) translateX(-50%); -webkit-transform: scaleY(0.105) translateY(-50%) translateX(-50%); -o-transform: scaleY(0.105) translateY(-50%) translateX(-50%); -moz-transform: scaleY(0.105) translateY(-50%) translateX(-50%); -ms-transform: scaleY(0.105) translateY(-50%) translateX(-50%); } <div style="margin-top: 200px;" class="border_angle border_angle_gold_l border_angle_gold-light_r first"></div> <div style="margin-top: 200px;" class="border_angle border_angle_gold_l border_angle_gold-light_r second"></div>
Just to complete the other good answers: The pseudo element / border approach You can create the triangles with the help of borders and apply it to the pseudo elements ::before and ::after of your divider. This reduces your code, you only need one element in your markup and you don't have to use transformations: .divider { position: relative; width: 500px; } .divider::before, .divider::after { content: ''; position: absolute; width: 0; height: 0; border-top: 20px solid transparent; border-bottom: 20px solid transparent; } .divider::before { border-right: 250px solid #bf9655; left: 0; } .divider::after { border-left: 250px solid #cda667; right: 0; } <div class="divider"></div> The SVG approach As SVG is widely supported now, it is also reasonable to use SVG to create shapes. Here would be a simple example, reducing the code length to a minimum of 141B: <svg viewbox="0 0 24 2"> <polygon points="0,1 12,0 12,2" style="fill:#bf9655;" /> <polygon points="12,0 24,1 12,2" style="fill:#cda667;" /> </svg>
How to hide a curve tail of a bubble chat box while gradient background colour using CSS only
How to hide a curve tail of bubble chat box while different background color using css ? body { background: #1e5799; background: -moz-linear-gradient(-45deg, #1e5799 0%, #2989d8 50%, #2989d8 50%, #7db9e8 100%); background: -webkit-linear-gradient(-45deg, #1e5799 0%,#2989d8 50%,#2989d8 50%,#7db9e8 100%); background: linear-gradient(135deg, #1e5799 0%,#2989d8 50%,#2989d8 50%,#7db9e8 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=1 ); } .speech-bubble { position: relative; background: #ddd; border-radius: .4em .4em .4em 0; width: 100px; padding: 30px 15px; margin:auto; text-align: center; color: white; font-weight: bold; font-size: 200%; text-shadow: 0 -0.05em 0.1em rgba(0,0,0,.3); } .speech-bubble:before { content: ""; position: absolute; z-index: -1; bottom: -30px; right: 100%; height: 30px; border-right: 25px solid #ddd; *background: #00aabb; -webkit-border-bottom-right-radius: 80px 50px; -moz-border-radius-bottomright: 80px 50px; border-bottom-right-radius: 80px 50px; -webkit-transform: translate(0, -2px); -moz-transform: translate(0, -2px); -ms-transform: translate(0, -2px); -o-transform: translate(0, -2px); transform: rotate(-181deg) translate(-35%, 97%); } /* creates part of the curved pointy bit */ .speech-bubble:after { content: ""; position: absolute; z-index: -1; bottom: -30px; right: 100%; width: 21px; height: 30px; background: #fff; -webkit-border-bottom-right-radius: 40px 50px; -moz-border-radius-bottomright: 40px 50px; border-bottom-right-radius: 40px 50px; -webkit-transform: translate(-30px, -2px); -moz-transform: translate(-30px, -2px); -ms-transform: translate(-30px, -2px); -o-transform: translate(-30px, -2px); transform: rotate(0deg) translate(0%, -97%); } <div class="speech-bubble"></div>
Honestly, the best way is to use photo shop and alter the image. You can maybe find a css Hack involving having a div with position and z-index sitting on top of the white corner...but that will be an ugly solution to a simple problem. Just find a better image or alter it yourself in photoshop or the like.
Just change it's background color to match the one of the body element: :root { --bgc: #ece8e8; /* defined background color */ } body { background: var(--bgc); /* used here */ } .speech-bubble { position: relative; background: #ddd; border-radius: .4em; width: 100px; padding: 30px 15px; margin: auto; text-align: center; color: white; font-weight: bold; font-size: 200%; text-shadow: 0 -0.05em 0.1em rgba(0,0,0,.3); } .speech-bubble:before { content: ""; position: absolute; z-index: -1; bottom: -30px; right: 100%; height: 30px; border-right: 25px solid #ddd; *background: #00aabb; -webkit-border-bottom-right-radius: 80px 50px; -moz-border-radius-bottomright: 80px 50px; border-bottom-right-radius: 80px 50px; -webkit-transform: translate(0, -2px); -moz-transform: translate(0, -2px); -ms-transform: translate(0, -2px); -o-transform: translate(0, -2px); transform: rotate(-181deg) translate(-35%, 97%); } /* creates part of the curved pointy bit */ .speech-bubble:after { content: ""; position: absolute; z-index: -1; bottom: -30px; right: 100%; width: 21px; height: 30px; background: var(--bgc); /* and here */ -webkit-border-bottom-right-radius: 40px 50px; -moz-border-radius-bottomright: 40px 50px; border-bottom-right-radius: 40px 50px; -webkit-transform: translate(-30px, -2px); -moz-transform: translate(-30px, -2px); -ms-transform: translate(-30px, -2px); -o-transform: translate(-30px, -2px); transform: rotate(0deg) translate(0%, -97%); } <div class="speech-bubble"></div> Preferably done with CSS Variables to make it dynamic so that you don't have to check if the two match or change it twice, while you can do it once on the :root element and be sure.
Firefox css spinner animation rendering issue
A spinner I want to use on my site looks bad on Firefox (48.0.2). Comparison between Firefox and Chrome (imgur) See the spinner live (Third spinner) Is there a fix for this rendering issue? Slowing the animation down didn't help so I'm turning to you guys (:D) and I don't think there is a fix for this yet on stackoverflow. Here is code demonstrating the problematic spinner: body { background: #0dc5c1; } .loader { font-size: 10px; margin: 50px auto; text-indent: -9999em; width: 11em; height: 11em; border-radius: 50%; background: #ffffff; background: -moz-linear-gradient(left, #ffffff 10%, rgba(255, 255, 255, 0) 42%); background: -webkit-linear-gradient(left, #ffffff 10%, rgba(255, 255, 255, 0) 42%); background: -o-linear-gradient(left, #ffffff 10%, rgba(255, 255, 255, 0) 42%); background: -ms-linear-gradient(left, #ffffff 10%, rgba(255, 255, 255, 0) 42%); background: linear-gradient(to right, #ffffff 10%, rgba(255, 255, 255, 0) 42%); position: relative; -webkit-animation: load3 1.4s infinite linear; animation: load3 1.4s infinite linear; -webkit-transform: translateZ(0); -ms-transform: translateZ(0); transform: translateZ(0); } .loader:before { width: 50%; height: 50%; background: #ffffff; border-radius: 100% 0 0 0; position: absolute; top: 0; left: 0; content: ''; } .loader:after { background: #0dc5c1; width: 75%; height: 75%; border-radius: 50%; content: ''; margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; } #-webkit-keyframes load3 { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } #keyframes load3 { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } <div class="loader">Loading...</div> Tested on Firefox, Chrome, Edge and IE(11). Only Firefox has problems.
body { background: #0dc5c1; } .loader { font-size: 10px; margin: 50px auto; /*text-indent: -9999em;*/ width: 11em; height: 11em; border-radius: 50%; background: #ffffff; background: -moz-linear-gradient(left, #ffffff 10%, rgba(255, 255, 255, 0) 42%); background: -webkit-linear-gradient(left, #ffffff 10%, rgba(255, 255, 255, 0) 42%); background: -o-linear-gradient(left, #ffffff 10%, rgba(255, 255, 255, 0) 42%); background: -ms-linear-gradient(left, #ffffff 10%, rgba(255, 255, 255, 0) 42%); background: linear-gradient(to right, #ffffff 10%, rgba(255, 255, 255, 0) 42%); position: relative; -webkit-animation: load 1.4s infinite linear; animation: load 1.4s infinite linear; /* -webkit-transform: translateZ(0); -ms-transform: translateZ(0); transform: translateZ(0);*/ } .loader:before { width: 50%; height: 50%; background: #ffffff; border-radius: 100% 0 0 0; position: absolute; top: 0; left: 0; content: ''; } .loader:after { background: #0dc5c1; width: 75%; height: 75%; border-radius: 50%; content: ''; margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; } #-webkit-keyframes load { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } #keyframes load { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } <div class="loader"></div>