This question already has answers here:
How to create a circle with links on border side
(8 answers)
Closed 5 years ago.
I'm looking but I can't find how create rounded menu like this on image. Is it posible only with html and css?
From 1 to 4 are buttons, any similar example would help.
i made your menu with html and css.
It was actually really simple:
HTML:
<div class='button-wrapper'>
<div class="btn1"></div>
<div class="btn2"></div>
<div class="btn3"></div>
<div class="btn4"></div>
</div>
CSS
.button-wrapper{
background-color: white;
width: 250px;
height: 250px;
padding: 50px;
position: relative;
transform: rotate(-45deg);
}
.btn1{
background: #EFE3B3;
width: 250px;
height: 125px;
border-top-left-radius: 150px;
border-top-right-radius: 150px;
}
.btn2{
background: #B6E438;
width: 125px;
height: 125px;
border-bottom-left-radius: 150px;
float: left;
}
.btn3{
background: #FEF035;
width: 125px;
height: 125px;
border-bottom-right-radius: 150px;
float: right;
}
.btn4{
background: #9BD9E9;
width: 50px;
height: 50px;
border-radius: 100px;
border: 20px solid #fff;
position: absolute;
top: 50%;
left: 50%;
transform: translate3d(-50%,-50%,0);
}
Also take a look at the plunkr I made.
if you want to have a pie chart, you can use highchart.js
or if you don't want to use highchart, you can use this code (this is what i found in code pen, it's a pen by patrick denny)
HTML
<div class="pie" data-start="0" data-value="30"></div>
<div class="pie highlight" data-start="30" data-value="30"></div>
<div class="pie" data-start="60" data-value="40"></div>
<div class="pie big" data-start="100" data-value="260"></div>
CSS
.pie {
position:absolute;
width:100px;
height:200px;
overflow:hidden;
left:150px;
-moz-transform-origin:left center;
-ms-transform-origin:left center;
-o-transform-origin:left center;
-webkit-transform-origin:left center;
transform-origin:left center;
}
.pie.big {
width:200px;
height:200px;
left:50px;
-moz-transform-origin:center center;
-ms-transform-origin:center center;
-o-transform-origin:center center;
-webkit-transform-origin:center center;
transform-origin:center center;
}
.pie:BEFORE {
content:"";
position:absolute;
width:100px;
height:200px;
left:-100px;
border-radius:100px 0 0 100px;
-moz-transform-origin:right center;
-ms-transform-origin:right center;
-o-transform-origin:right center;
-webkit-transform-origin:right center;
transform-origin:right center;
}
.pie.big:BEFORE {
left:0px;
}
.pie.big:AFTER {
content:"";
position:absolute;
width:100px;
height:200px;
left:100px;
border-radius:0 100px 100px 0;
}
.pie:nth-of-type(1):BEFORE,
.pie:nth-of-type(1):AFTER {
background-color:blue;
}
.pie:nth-of-type(2):AFTER,
.pie:nth-of-type(2):BEFORE {
background-color:green;
}
.pie:nth-of-type(3):AFTER,
.pie:nth-of-type(3):BEFORE {
background-color:red;
}
.pie:nth-of-type(4):AFTER,
.pie:nth-of-type(4):BEFORE {
background-color:orange;
}
.pie[data-start="30"] {
-moz-transform: rotate(30deg); /* Firefox */
-ms-transform: rotate(30deg); /* IE */
-webkit-transform: rotate(30deg); /* Safari and Chrome */
-o-transform: rotate(30deg); /* Opera */
transform:rotate(30deg);
}
.pie[data-start="60"] {
-moz-transform: rotate(60deg); /* Firefox */
-ms-transform: rotate(60deg); /* IE */
-webkit-transform: rotate(60deg); /* Safari and Chrome */
-o-transform: rotate(60deg); /* Opera */
transform:rotate(60deg);
}
.pie[data-start="100"] {
-moz-transform: rotate(100deg); /* Firefox */
-ms-transform: rotate(100deg); /* IE */
-webkit-transform: rotate(100deg); /* Safari and Chrome */
-o-transform: rotate(100deg); /* Opera */
transform:rotate(100deg);
}
.pie[data-value="30"]:BEFORE {
-moz-transform: rotate(31deg); /* Firefox */
-ms-transform: rotate(31deg); /* IE */
-webkit-transform: rotate(31deg); /* Safari and Chrome */
-o-transform: rotate(31deg); /* Opera */
transform:rotate(31deg);
}
.pie[data-value="40"]:BEFORE {
-moz-transform: rotate(41deg); /* Firefox */
-ms-transform: rotate(41deg); /* IE */
-webkit-transform: rotate(41deg); /* Safari and Chrome */
-o-transform: rotate(41deg); /* Opera */
transform:rotate(41deg);
}
.pie[data-value="260"]:BEFORE {
-moz-transform: rotate(260deg); /* Firefox */
-ms-transform: rotate(260deg); /* IE */
-webkit-transform: rotate(260deg); /* Safari and Chrome */
-o-transform: rotate(260deg); /* Opera */
transform:rotate(260deg);
}
JUST copy and paste this code to a fresh html page and see the changes
Related
I've been trying to solve a sideways header problem. I intend on creating a globally sideways header like so on a website: sideways header
However, my problem arises trying to separate the type (it's also breaking on 2 lines). I can't seem to make the vertical line contained or centered within the rectangle . When I resize my browser window it does not stay contained within the rectangle box. I would GREATLY appreciate any suggestions and advice!
What I have so far:
.box {
height: 1326px;
width: 112px;
background-color: transparent;
border: 1px solid #f9f0e4;
}
.bottom {
text-align: center;
color: #000000;
/* Safari */
-webkit-transform: rotate(-90deg);
/* Firefox */
-moz-transform: rotate(-90deg);
/* IE */
-ms-transform: rotate(-90deg);
/* Opera */
-o-transform: rotate(-90deg);
/* Internet Explorer */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
.top {
text-align: center;
color: #000000;
/* Safari */
-webkit-transform: rotate(-90deg);
/* Firefox */
-moz-transform: rotate(-90deg);
/* IE */
-ms-transform: rotate(-90deg);
/* Opera */
-o-transform: rotate(-90deg);
/* Internet Explorer */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
.vl {
border-left: 1px solid #f9f0e4;
height: 620px;
position: absolute;
left: 50%;
top: 0;
}
<div class="container">
<div class="box">
<p class="bottom">CREATIVE STUDIO</p>
<div class="vl">
<p class="top">FLORENCE — ITALY</p>
</div>
</div>
</div>
You can instead consider rotation on the whole box and use vh unit so the width is relative to height since it's getting rotated :
.box {
background-color: transparent;
width: 80vh;
border: 1px solid;
transform: rotate(-90deg) translate(-50%, 0);
transform-origin: center;
}
.box {
display: flex;
justify-content: space-between;
text-align: center;
color: #000000;
}
.bottom {
text-align: center;
color: #000000;
margin-left: 10px;
}
.top {
text-align: center;
color: #000000;
margin-right: 10px;
}
<div class="box">
<p class="bottom">CREATIVE STUDIO</p>
<p class="top">FLORENCE — ITALY</p>
</div>
What will be the code for such kind of border
try This
Html
<div class="wrapper">
<div id="container_2"><img src="https://cdn1.iconfinder.com/data/icons/iconbeast-lite/30/crown.png"/></div><div id="container_2"><img src="https://cdn1.iconfinder.com/data/icons/iconbeast-lite/30/crown.png"/></div>
<div id="container_2"><img src="https://cdn1.iconfinder.com/data/icons/iconbeast-lite/30/crown.png"/></div><div id="container_2"><img src="https://cdn1.iconfinder.com/data/icons/iconbeast-lite/30/crown.png"/></div>
</div>
Css
#container_2 {
width: 80px;
height: 80px;
margin:16px;
float:left;
border: 1px solid red;
-webkit-transform: rotate(45deg); /* Safari and Chrome */
-moz-transform: rotate(45deg); /* Firefox */
-ms-transform: rotate(45deg); /* IE 9 */
-o-transform: rotate(45deg); /* Opera */
transform: rotate(45deg);
}
.wrapper
{
padding:20px;
border:1px solid black;
float:left;
}
img
{
-webkit-transform: rotate(-45deg); /* Safari and Chrome */
-moz-transform: rotate(-45deg); /* Firefox */
-ms-transform: rotate(-45deg); /* IE 9 */
-o-transform: rotate(-45deg); /* Opera */
transform: rotate(-45deg);
position: absolute;
top: 21px;
left: 21px;
}
Demo Here
#container_2 {
width: 80px;
height: 80px;
margin:16px;
float:left;
border: 1px solid red;
-webkit-transform: rotate(45deg); /* Safari and Chrome */
-moz-transform: rotate(45deg); /* Firefox */
-ms-transform: rotate(45deg); /* IE 9 */
-o-transform: rotate(45deg); /* Opera */
transform: rotate(45deg);
}
.wrapper
{
padding:20px;
border:1px solid black;
float:left;
}
img
{
-webkit-transform: rotate(-45deg); /* Safari and Chrome */
-moz-transform: rotate(-45deg); /* Firefox */
-ms-transform: rotate(-45deg); /* IE 9 */
-o-transform: rotate(-45deg); /* Opera */
transform: rotate(-45deg);
position: absolute;
top: 21px;
left: 21px;
}
<div class="wrapper">
<div id="container_2"><img src="https://cdn1.iconfinder.com/data/icons/iconbeast-lite/30/crown.png"/></div><div id="container_2"><img src="https://cdn1.iconfinder.com/data/icons/iconbeast-lite/30/crown.png"/></div>
<div id="container_2"><img src="https://cdn1.iconfinder.com/data/icons/iconbeast-lite/30/crown.png"/></div><div id="container_2"><img src="https://cdn1.iconfinder.com/data/icons/iconbeast-lite/30/crown.png"/></div>
</div>
.reddiv {
background: #FF0000;
border-radius: 50%;
display: block;
height: 60px;
width: 60px;
}
.reddiv::after {
content:"\2193"; /* The code for the arrow : see the reference */
display: block;
color: white;
font-weight: bolder;
font-size: 40px; /* Adjust for your needs */
text-align: center;
}
This is the plnk url
http://plnkr.co/edit/lSh4cGgT4lRorQd4Lg6s?p=preview
I am unable to understand on how to proceed further
Use it in a single animation and use transform rotate.
#keyframes slidedown {
0% {
margin-top: 0;
}
30%{
margin-top: 300px;
-ms-transform: rotate(0deg); /* IE 9 */
-webkit-transform: rotate(0deg); /* Chrome, Safari, Opera */
transform: rotate(0deg);
}
60% {
-ms-transform: rotate(-90deg); /* IE 9 */
-webkit-transform: rotate(-90deg); /* Chrome, Safari, Opera */
transform: rotate(-90deg);
margin-top: 300px;
margin-left: 0;
}
100%{
-ms-transform: rotate(-90deg); /* IE 9 */
-webkit-transform: rotate(-90deg); /* Chrome, Safari, Opera */
transform: rotate(-90deg);
margin-top: 300px;
margin-left: 300px;
}
}
Here is a the forked plnk
Can someone explain why my purple box overlaps my yellow box in this demo?
I'd like my yellow box to appear first & then my purple box to be 10px below it.
Demo: http://jsfiddle.net/t0x0y7ax/
#container {
position: fixed;
top: 50%;
left:-55px;
}
#feedback1 {
background:yellow;
height: 50px;
width: 160px;
margin-bottom:10px;
transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
#feedback2 {
background:purple;
height: 50px;
width: 160px;
transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
<div id="container">
<div id="feedback1">Feedback</div>
<div id="feedback2">Feedback</div>
</div>
Personally, I would just transform the container...it makes it much easier all round
JSfiddle Demo
* {
margin: 0;
padding: 0;
}
#container {
position: fixed;
top:50%;
left:0;
border:1px solid red;
transform-origin:top left;
transform: rotate(-90deg) translate(-100%, 0%);
}
#feedback1 {
background:yellow;
height: 50px;
width: 160px;
float: right; /* to correct order when rotated */
}
#feedback2 {
background:purple;
height: 50px;
width: 160px;
float: right; /* to correct order when rotated */
}
<div id="container">
<div id="feedback1">Feedback</div>
<div id="feedback2">Feedback</div>
</div>
It is because of the rotation as the commentator specified. You can float them to get them to show up next to each other - http://jsfiddle.net/t0x0y7ax/2/.
#container {
position: fixed;
top: 50%;
left:-55px;
}
#feedback1 {
float: left;
background:yellow;
height: 50px;
width: 160px;
margin-bottom:10px;
transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
#feedback2 {
float: left;
background:purple;
height: 50px;
width: 160px;
transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
Updated Fiddle - http://jsfiddle.net/t0x0y7ax/12/
I want to align a text vertically(That is 270 degree) and in the vertical middle of an image. This is what i actually want
I tried with CSS 'transform' property but its not working for me. Here i tried the code . And the HTML and CSS code i tried is
HTML :
<div id="img-container">
<label id="lblConfidence">Confidence</label>
<label id="lblHigh">High</label>
<div id="image"></div>
<label id="lblLow">Low</label>
</div>
CSS :
#img-container{
margin: 0 auto;
padding:0;
}
#image{
border:5px solid red;
margin-left:50px;
width:10px;
height:100px;
}
#lblConfidence{
vertical-align:middle;
transform:rotate(270deg) ;
-ms-transform:rotate(270deg) ; /* IE 9 */
-transform:rotate(270deg) ; /* Opera, Chrome, and Safari */
}
#lblLow{
margin-left:48px;
}
#lblHigh{
margin-left:48px;
}
Here's a solution that relies on pseudo-elements and thus uses minimal markup: http://jsfiddle.net/C49q7/1/. A particular emphasis has been placed on the alignment of elements. The #image element can be moved anywhere. The labels follow it precisely.
HTML:
<div id="image"><span></span></div>
CSS:
#image {
border:5px solid red;
width:100px;
height:20px;
text-align: center;
box-sizing: border-box;
position: relative;
font-family: Arial, Helvetica, Sans-Serif;
font-size: 12px;
-webkit-transform: rotate(-90deg);
transform: rotate(-90deg);
margin-top: 100px;
}
#image:before {
content: "Conidence";
position: absolute;
top: -24px;
left: 0;
right: 0;
text-align: center;
}
#image > span:before {
content: "High";
position: absolute;
right: -25px;
font-size: 10px;
top: 50%;
-webkit-transform: translateY(-50%) rotate(90deg);
transform: translateY(-50%) rotate(90deg);
}
#image > span:after {
content: "Low";
position: absolute;
left: -25px;
font-size: 10px;
top: 50%;
-webkit-transform: translateY(-50%) rotate(90deg);
transform: translateY(-50%) rotate(90deg);
}
add css to container.
#img-container {
position: relative;
}
add css to label.
#lblConfidence {
position: absolute;
top: 50%; -moz-transform:
rotate(270deg);
-webkit-transform: rotate(270deg);
-o-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
}
Here only given a style for align the label 50%. But it is depending on the length of the label. if this label is dynamic, please use a javascript to set the " top: 50%" style. and change the value relatively to the length of label.
Please replace lable with div and use below CSS for lblConfidence :
#lblConfidence
{
transform: rotate(-90deg);
-webkit-transform: rotate(-90deg); /* Safari/Chrome */
-moz-transform: rotate(-90deg); /* Firefox */
-o-transform: rotate(-90deg); /* Opera */
-ms-transform: rotate(-90deg); /* IE 9 */
writing-mode: tb-rl; /* IE 8 */
filter: flipv fliph; /* IE 8 */
margin-top: 100px;
width: 200px;
text-align: center;
height: 50px;
background:#ccc;
}
you can refer this solution : http://jsbin.com/joqofu/3
<div class="container">
<div class="left"><label>Confidence</label></div>
<div class="right">
<label id="lblHigh">High</label>
<div id="image"></div>
<label id="lblLow">Low</label>
</div>
</div>
and css
.container{
position:relative;
}
#image{
border:5px solid red;
width:10px;
height:100px;
}
.left {
position:absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
display:block;
height:120px;
width:100px;
text-align:left;
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
.right{
margin-left:10px;
float:left;
text-align:left;
}