CSS not resizing items in grid - html

My items within the grid are not re sizing for responsiveness in tablet and mobile view. They are looking cut off. Please any help would be greatly appreciated.
Please let me know if you need to see a screen shot of what is occurring.
.ch-grid {
margin: -10px 0 0 0;
padding: 0;
list-style: none;
display: block;
text-align: center;
width: 100%;
overflow: hidden;
height: auto;
clear: both;
}
.ch-grid:after,
.ch-item:before {
content: '';
display: table;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
clear: both;
}
.ch-grid:after {
clear: both;
}
.ch-grid li {
width: 200px;
height: 200px;
display: inline-block;
margin: 10px;
overflow: hidden;
}
.ch-item {
width: 100%;
height: 100%;
border-radius: 50%;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 0 rgba(247, 168, 0, 0.4), inset 0 0 0 16px rgba(247, 168, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.1);
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
z-index: 5;
}
.ch-img-4 {
background-image: url(images/4.jpg);
}
.ch-img-5 {
background-image: url(images/5.jpg);
}
.ch-img-6 {
background-image: url(images/6.jpg);
}
.ch-img-1 {
background-image: url(images/1.jpg);
}
.ch-img-2 {
background-image: url(images/2.jpg);
}
.ch-img-3 {
background-image: url(images/3.jpg);
}
.ch-info {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-backface-visibility: hidden;
/*for a smooth font */
}
.ch-info h3 {
color: #fff;
text-transform: uppercase;
position: relative;
letter-spacing: 2px;
font-size: 22px;
margin: 0 30px;
padding: 65px 0 0 0;
height: 110px;
font-family: 'Open Sans', Arial, sans-serif;
text-shadow: 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.3);
}
.ch-info p {
color: #fff;
padding: 10px 5px;
font-style: italic;
margin: 0 30px;
font-size: 20px;
border-top: 1px solid rgba(255, 255, 255, 0.5);
}
.ch-info p a {
display: block;
color: #fff;
color: rgba(255, 255, 255, 0.7);
font-style: normal;
font-weight: 700;
text-transform: uppercase;
font-size: 9px;
letter-spacing: 1px;
padding-top: 4px;
font-family: 'Open Sans', Arial, sans-serif;
}
.ch-info p a:hover {
color: #fff222;
color: rgba(247, 168, 0, 0.8);
}
.ch-item:hover {
box-shadow: inset 0 0 0 110px rgba(0, 155, 222, 0.4), inset 0 0 0 16px rgba(0, 155, 222, 0.8), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.ch-item:hover .ch-info {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.mini-title {
position: absolute;
z-index: 2000;
top: 10%;
left: 0;
margin: auto;
color: #fff;
text-align: center;
right: 0;
overflow: hidden;
padding-bottom: 0px;
margin-bottom: 0px;
width: auto;
height: auto;
clear: both;
min-width: 250px;
}
<section class="bg-image section-g clearfix">
<div class="image-wrapper col-md-6 col-sm-3 pull-left">
<div class="background-image-wrapper wow slideInLeft">
<img class="background-image" alt="" src="images/bg_01.jpg">
<div class="mini-title">
<ul class="ch-grid">
<li>
<div class="ch-item ch-img-4">
<div class="ch-info">
<h3>Gail</h3>
<p>mom</p>
</div>
</div>
</li>
<li>
<div class="ch-item ch-img-5">
<div class="ch-info">
<h3>Jeff</h3>
<p>dad</p>
</div>
</div>
</li>
<li>
<div class="ch-item ch-img-6">
<div class="ch-info">
<h3>Heidi</h3>
<p>equestrian</p>
</div>
</div>
</li>
</ul>
<ul class="ch-grid">
<li>
<div class="ch-item ch-img-1">
<div class="ch-info">
<h3>Joey</h3>
<p>drummer</p>
</div>
</div>
</li>
<li>
<div class="ch-item ch-img-2">
<div class="ch-info">
<h3>Laura</h3>
<p>soccer player</p>
</div>
</div>
</li>
<li>
<div class="ch-item ch-img-3">
<div class="ch-info">
<h3>Sara</h3>
<p>artist</p>
</div>
</div>
</li>
</ul>
</div>
<!-- end mini-title -->
</div>
</div>

You can use vh and vw in order to display sizes according to viewport dimensions. This way, you can specify the height for your h3 tag:
.ch-info h3 {
color: #fff;
text-transform: uppercase;
position: relative;
letter-spacing: 2px;
font-size: 22px;
margin: 0 30px;
padding: 65px 0 0 0;
height: 15vh;
font-family: 'Open Sans', Arial, sans-serif;
text-shadow: 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.3);
}
Or whatever you want.
See the snippet for an exemple :
.ch-grid {
margin: -10px 0 0 0;
padding: 0;
list-style: none;
display: block;
text-align: center;
width: 100%;
overflow: hidden;
height: auto;
clear: both;
}
.ch-grid:after,
.ch-item:before {
content: '';
display: table;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
clear: both;
}
.ch-grid:after {
clear: both;
}
.ch-grid li {
width: 200px;
height: 200px;
display: inline-block;
margin: 10px;
overflow: hidden;
}
.ch-item {
width: 100%;
height: 100%;
border-radius: 50%;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 0 rgba(247, 168, 0, 0.4), inset 0 0 0 16px rgba(247, 168, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.1);
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
z-index: 5;
}
.ch-img-4 {
background-image: url(images/4.jpg);
}
.ch-img-5 {
background-image: url(images/5.jpg);
}
.ch-img-6 {
background-image: url(images/6.jpg);
}
.ch-img-1 {
background-image: url(images/1.jpg);
}
.ch-img-2 {
background-image: url(images/2.jpg);
}
.ch-img-3 {
background-image: url(images/3.jpg);
}
.ch-info {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-backface-visibility: hidden;
/*for a smooth font */
}
.ch-info h3 {
color: #fff;
text-transform: uppercase;
position: relative;
letter-spacing: 2px;
font-size: 22px;
margin: 0 30px;
padding: 65px 0 0 0;
height: 15vh;
font-family: 'Open Sans', Arial, sans-serif;
text-shadow: 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.3);
}
.ch-info p {
color: #fff;
padding: 10px 5px;
font-style: italic;
margin: 0 30px;
font-size: 20px;
border-top: 1px solid rgba(255, 255, 255, 0.5);
}
.ch-info p a {
display: block;
color: #fff;
color: rgba(255, 255, 255, 0.7);
font-style: normal;
font-weight: 700;
text-transform: uppercase;
font-size: 9px;
letter-spacing: 1px;
padding-top: 4px;
font-family: 'Open Sans', Arial, sans-serif;
}
.ch-info p a:hover {
color: #fff222;
color: rgba(247, 168, 0, 0.8);
}
.ch-item:hover {
box-shadow: inset 0 0 0 110px rgba(0, 155, 222, 0.4), inset 0 0 0 16px rgba(0, 155, 222, 0.8), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.ch-item:hover .ch-info {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.mini-title {
position: absolute;
z-index: 2000;
top: 10%;
left: 0;
margin: auto;
color: #fff;
text-align: center;
right: 0;
overflow: hidden;
padding-bottom: 0px;
margin-bottom: 0px;
width: auto;
height: auto;
clear: both;
min-width: 250px;
}
<section class="bg-image section-g clearfix">
<div class="image-wrapper col-md-6 col-sm-3 pull-left">
<div class="background-image-wrapper wow slideInLeft">
<img class="background-image" alt="" src="images/bg_01.jpg">
<div class="mini-title">
<ul class="ch-grid">
<li>
<div class="ch-item ch-img-4">
<div class="ch-info">
<h3>Gail</h3>
<p>mom</p>
</div>
</div>
</li>
<li>
<div class="ch-item ch-img-5">
<div class="ch-info">
<h3>Jeff</h3>
<p>dad</p>
</div>
</div>
</li>
<li>
<div class="ch-item ch-img-6">
<div class="ch-info">
<h3>Heidi</h3>
<p>equestrian</p>
</div>
</div>
</li>
</ul>
<ul class="ch-grid">
<li>
<div class="ch-item ch-img-1">
<div class="ch-info">
<h3>Joey</h3>
<p>drummer</p>
</div>
</div>
</li>
<li>
<div class="ch-item ch-img-2">
<div class="ch-info">
<h3>Laura</h3>
<p>soccer player</p>
</div>
</div>
</li>
<li>
<div class="ch-item ch-img-3">
<div class="ch-info">
<h3>Sara</h3>
<p>artist</p>
</div>
</div>
</li>
</ul>
</div>
<!-- end mini-title -->
</div>
</div>
EDIT: As #Jamie Barker noticed, this solution isn't 100% working, depending on viewport size. To prevent this behaviour, you can use media queries for tablets/phones, or max-height

Related

how do I reposition a styled label to a corner of its div?

How would I move the content inside of .toggle-button to the far right lower corner?
I am new to html and css but from what I understand I've played around with the flex settings, margins, and paddings and I'm not having any luck figuring this out
Here is my code. I am only concerned with the page-header div (color blue border) and the toggle-button div (color purple)
.mypage{
border: 1px solid black;
}
.row {
margin: 10px;
width: 100%;
}
.page-header {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
border: 1px solid blue;
margin-right: 1vh;
}
.date-dropdown{
border: 1px solid red;
flex-grow: 1;
display: flex;
}
.dates-label {
font-size: large;
font-family: Arial, Helvetica, sans-serif;
}
.dates-select {
margin-left: 1vh;
}
.title-wrapper {
border: 1px solid orange;
flex-grow: 1;
text-align: center;
}
.toggle-button{
border: 1px solid purple;
flex-grow: 1;
}
/* ============= TOGGLE Button ======= */
.switch {
position: relative;
display: block;
vertical-align: top;
width: 100px;
height: 30px;
padding: 3px;
margin: 0 10px 10px 0;
background: linear-gradient(to bottom, #eeeeee, #FFFFFF 25px);
background-image: -webkit-linear-gradient(top, #eeeeee, #FFFFFF 25px);
border-radius: 18px;
box-shadow: inset 0 -1px white, inset 0 1px 1px rgba(0, 0, 0, 0.05);
cursor: pointer;
box-sizing:content-box;
}
.switch-input {
position: absolute;
top: 0;
left: 0;
opacity: 0;
box-sizing:content-box;
}
.switch-label {
position: relative;
display: block;
height: inherit;
font-size: 10px;
text-transform: uppercase;
background: #eceeef;
border-radius: inherit;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0 2px rgba(0, 0, 0, 0.15);
box-sizing:content-box;
}
.switch-label:before, .switch-label:after {
position: absolute;
top: 50%;
margin-top: -.5em;
line-height: 1;
-webkit-transition: inherit;
-moz-transition: inherit;
-o-transition: inherit;
transition: inherit;
box-sizing:content-box;
}
.switch-label:before {
content: attr(data-off);
right: 11px;
color: #aaaaaa;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.switch-label:after {
content: attr(data-on);
left: 11px;
color: #FFFFFF;
text-shadow: 0 1px rgba(0, 0, 0, 0.2);
opacity: 0;
}
.switch-input:checked ~ .switch-label {
background: #E1B42B;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15), inset 0 0 3px rgba(0, 0, 0, 0.2);
}
.switch-input:checked ~ .switch-label:before {
opacity: 0;
}
.switch-input:checked ~ .switch-label:after {
opacity: 1;
}
.switch-handle {
position: absolute;
top: 4px;
left: 4px;
width: 28px;
height: 28px;
background: linear-gradient(to bottom, #FFFFFF 40%, #f0f0f0);
background-image: -webkit-linear-gradient(top, #FFFFFF 40%, #f0f0f0);
border-radius: 100%;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
}
.switch-handle:before {
content: "";
position: absolute;
top: 50%;
left: 50%;
margin: -6px 0 0 -6px;
width: 12px;
height: 12px;
background: linear-gradient(to bottom, #eeeeee, #FFFFFF);
background-image: -webkit-linear-gradient(top, #eeeeee, #FFFFFF);
border-radius: 6px;
box-shadow: inset 0 1px rgba(0, 0, 0, 0.02);
}
.switch-input:checked ~ .switch-handle {
left: 74px;
box-shadow: -1px 1px 5px rgba(0, 0, 0, 0.2);
}
/* Transition
========================== */
.switch-label, .switch-handle {
transition: All 0.3s ease;
-webkit-transition: All 0.3s ease;
-moz-transition: All 0.3s ease;
-o-transition: All 0.3s ease;
}
.switch-yes-no {
padding: 0;
margin: 15px 0 0;
background: #FFF;
border-radius: 0;
background-image: none;
}
.switch-yes-no .switch-label {
box-shadow: none;
background: none;
}
.switch-yes-no .switch-label:after, .switch-yes-no .switch-label:before {
width: 100%;
height: 70%;
top: 5px;
left: 0;
text-align: center;
padding-top: 10%;
box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.2), inset 0 0 3px rgba(0, 0, 0, 0.1);
}
.switch-yes-no .switch-label:after {
color: #FFFFFF;
background: #32CD32;
backface-visibility: hidden;
transform: rotateY(180deg);
}
.switch-yes-no .switch-label:before {
background: #eceeef;
backface-visibility: hidden;
}
.switch-yes-no .switch-handle {
display: none;
}
.switch-yes-no .switch-input:checked ~ .switch-label {
background: #FFF;
border-color: #0088cc;
}
.switch-yes-no .switch-input:checked ~ .switch-label:before {
transform: rotateY(180deg)
}
.switch-yes-no .switch-input:checked ~ .switch-label:after {
transform: rotateY(0)
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML5 boilerplate – all you really need…</title>
<link rel="stylesheet" href="css/styles.css">
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body id="home">
<div class="mypage">
<div class="row">
<div class="page-header">
<div class="date-dropdown">
<div class="dates-label">
<label for="dropdown">
Choose a date
</label>
</div>
<div class="dates-select">
<select name="dropdown" id="datesid">
<option>option 1</option>
<option>option 2</option>
<option>option 3</option>
</select>
</div>
</div>
<div class="title-wrapper">
<h1>Welcome</h1>
</div>
<div class="toggle-button">
<label class="switch switch-yes-no">
<input class="switch-input" type="checkbox" />
<span class="switch-label" data-on="Yes" data-off="No"></span>
<span class="switch-handle"></span>
</label>
</div>
</div>
</div>
<div class="row">
<div class="table-pie-wrapper">
<div class="table">
i am a table
</div>
<div class="pie-graph">
i am a pie graph
</div>
</div>
</div>
<div class="row">
<div class="table-summary-wrapper">
<div class="table-summary">
i am a table summary
</div>
</div>
</div>
</div>
</body>
</html>
I addded following css rules toggle-button class
display: flex;
justify-content: end;
Please check the following code snippet
.mypage{
border: 1px solid black;
}
.row {
margin: 10px;
width: 100%;
}
.page-header {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
border: 1px solid blue;
margin-right: 1vh;
}
.date-dropdown{
border: 1px solid red;
flex-grow: 1;
display: flex;
}
.dates-label {
font-size: large;
font-family: Arial, Helvetica, sans-serif;
}
.dates-select {
margin-left: 1vh;
}
.title-wrapper {
border: 1px solid orange;
flex-grow: 1;
text-align: center;
}
.toggle-button{
border: 1px solid purple;
flex-grow: 1;
display: flex;
justify-content: end;
}
/* ============= TOGGLE Button ======= */
.switch {
position: relative;
display: block;
vertical-align: top;
width: 100px;
height: 30px;
padding: 3px;
margin: 0 10px 10px 0;
background: linear-gradient(to bottom, #eeeeee, #FFFFFF 25px);
background-image: -webkit-linear-gradient(top, #eeeeee, #FFFFFF 25px);
border-radius: 18px;
box-shadow: inset 0 -1px white, inset 0 1px 1px rgba(0, 0, 0, 0.05);
cursor: pointer;
box-sizing:content-box;
}
.switch-input {
position: absolute;
top: 0;
left: 0;
opacity: 0;
box-sizing:content-box;
}
.switch-label {
position: relative;
display: block;
height: inherit;
font-size: 10px;
text-transform: uppercase;
background: #eceeef;
border-radius: inherit;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0 2px rgba(0, 0, 0, 0.15);
box-sizing:content-box;
text-align: right;
background-color: red;
}
.switch-label:before, .switch-label:after {
position: absolute;
top: 50%;
margin-top: -.5em;
line-height: 1;
-webkit-transition: inherit;
-moz-transition: inherit;
-o-transition: inherit;
transition: inherit;
box-sizing:content-box;
}
.switch-label:before {
content: attr(data-off);
right: 11px;
color: #aaaaaa;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.switch-label:after {
content: attr(data-on);
left: 11px;
color: #FFFFFF;
text-shadow: 0 1px rgba(0, 0, 0, 0.2);
opacity: 0;
}
.switch-input:checked ~ .switch-label {
background: #E1B42B;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15), inset 0 0 3px rgba(0, 0, 0, 0.2);
}
.switch-input:checked ~ .switch-label:before {
opacity: 0;
}
.switch-input:checked ~ .switch-label:after {
opacity: 1;
}
.switch-handle {
position: absolute;
top: 4px;
left: 4px;
width: 28px;
height: 28px;
background: linear-gradient(to bottom, #FFFFFF 40%, #f0f0f0);
background-image: -webkit-linear-gradient(top, #FFFFFF 40%, #f0f0f0);
border-radius: 100%;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
}
.switch-handle:before {
content: "";
position: absolute;
top: 50%;
left: 50%;
margin: -6px 0 0 -6px;
width: 12px;
height: 12px;
background: linear-gradient(to bottom, #eeeeee, #FFFFFF);
background-image: -webkit-linear-gradient(top, #eeeeee, #FFFFFF);
border-radius: 6px;
box-shadow: inset 0 1px rgba(0, 0, 0, 0.02);
}
.switch-input:checked ~ .switch-handle {
left: 74px;
box-shadow: -1px 1px 5px rgba(0, 0, 0, 0.2);
}
/* Transition
========================== */
.switch-label, .switch-handle {
transition: All 0.3s ease;
-webkit-transition: All 0.3s ease;
-moz-transition: All 0.3s ease;
-o-transition: All 0.3s ease;
}
.switch-yes-no {
padding: 0;
margin: 15px 0 0;
background: #FFF;
border-radius: 0;
background-image: none;
}
.switch-yes-no .switch-label {
box-shadow: none;
background: none;
}
.switch-yes-no .switch-label:after, .switch-yes-no .switch-label:before {
width: 100%;
height: 70%;
top: 5px;
left: 0;
text-align: center;
padding-top: 10%;
box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.2), inset 0 0 3px rgba(0, 0, 0, 0.1);
}
.switch-yes-no .switch-label:after {
color: #FFFFFF;
background: #32CD32;
backface-visibility: hidden;
transform: rotateY(180deg);
}
.switch-yes-no .switch-label:before {
background: #eceeef;
backface-visibility: hidden;
}
.switch-yes-no .switch-handle {
display: none;
}
.switch-yes-no .switch-input:checked ~ .switch-label {
background: #FFF;
border-color: #0088cc;
}
.switch-yes-no .switch-input:checked ~ .switch-label:before {
transform: rotateY(180deg)
}
.switch-yes-no .switch-input:checked ~ .switch-label:after {
transform: rotateY(0)
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML5 boilerplate – all you really need…</title>
<link rel="stylesheet" href="css/styles.css">
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body id="home">
<div class="mypage">
<div class="row">
<div class="page-header">
<div class="date-dropdown">
<div class="dates-label">
<label for="dropdown">
Choose a date
</label>
</div>
<div class="dates-select">
<select name="dropdown" id="datesid">
<option>option 1</option>
<option>option 2</option>
<option>option 3</option>
</select>
</div>
</div>
<div class="title-wrapper">
<h1>Welcome</h1>
</div>
<div class="toggle-button">
<label class="switch switch-yes-no">
<input class="switch-input" type="checkbox" />
<span class="switch-label" data-on="Yes" data-off="No"></span>
<span class="switch-handle"></span>
</label>
</div>
</div>
</div>
<div class="row">
<div class="table-pie-wrapper">
<div class="table">
i am a table
</div>
<div class="pie-graph">
i am a pie graph
</div>
</div>
</div>
<div class="row">
<div class="table-summary-wrapper">
<div class="table-summary">
i am a table summary
</div>
</div>
</div>
</div>
</body>
</html>
You can achieve this with margin-left: auto or in the shorthand that you used:
.switch-yes-no {
...
margin: 15px 0 0 auto;
}
Working example:
.mypage {
border: 1px solid black;
}
.row {
margin: 10px;
width: 100%;
}
.page-header {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
border: 1px solid blue;
margin-right: 1vh;
}
.date-dropdown {
border: 1px solid red;
flex-grow: 1;
display: flex;
}
.dates-label {
font-size: large;
font-family: Arial, Helvetica, sans-serif;
}
.dates-select {
margin-left: 1vh;
}
.title-wrapper {
border: 1px solid orange;
flex-grow: 1;
text-align: center;
}
.toggle-button {
border: 1px solid purple;
flex-grow: 1;
}
/* ============= TOGGLE Button ======= */
.switch {
position: relative;
display: block;
vertical-align: top;
width: 100px;
height: 30px;
padding: 3px;
margin: 0 10px 10px 0;
background: linear-gradient(to bottom, #eeeeee, #FFFFFF 25px);
background-image: -webkit-linear-gradient(top, #eeeeee, #FFFFFF 25px);
border-radius: 18px;
box-shadow: inset 0 -1px white, inset 0 1px 1px rgba(0, 0, 0, 0.05);
cursor: pointer;
box-sizing: content-box;
}
.switch-input {
position: absolute;
top: 0;
left: 0;
opacity: 0;
box-sizing: content-box;
}
.switch-label {
position: relative;
display: block;
height: inherit;
font-size: 10px;
text-transform: uppercase;
background: #eceeef;
border-radius: inherit;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0 2px rgba(0, 0, 0, 0.15);
box-sizing: content-box;
}
.switch-label:before,
.switch-label:after {
position: absolute;
top: 50%;
margin-top: -.5em;
line-height: 1;
-webkit-transition: inherit;
-moz-transition: inherit;
-o-transition: inherit;
transition: inherit;
box-sizing: content-box;
}
.switch-label:before {
content: attr(data-off);
right: 11px;
color: #aaaaaa;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.switch-label:after {
content: attr(data-on);
left: 11px;
color: #FFFFFF;
text-shadow: 0 1px rgba(0, 0, 0, 0.2);
opacity: 0;
}
.switch-input:checked~.switch-label {
background: #E1B42B;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15), inset 0 0 3px rgba(0, 0, 0, 0.2);
}
.switch-input:checked~.switch-label:before {
opacity: 0;
}
.switch-input:checked~.switch-label:after {
opacity: 1;
}
.switch-handle {
position: absolute;
top: 4px;
left: 4px;
width: 28px;
height: 28px;
background: linear-gradient(to bottom, #FFFFFF 40%, #f0f0f0);
background-image: -webkit-linear-gradient(top, #FFFFFF 40%, #f0f0f0);
border-radius: 100%;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
}
.switch-handle:before {
content: "";
position: absolute;
top: 50%;
left: 50%;
margin: -6px 0 0 -6px;
width: 12px;
height: 12px;
background: linear-gradient(to bottom, #eeeeee, #FFFFFF);
background-image: -webkit-linear-gradient(top, #eeeeee, #FFFFFF);
border-radius: 6px;
box-shadow: inset 0 1px rgba(0, 0, 0, 0.02);
}
.switch-input:checked~.switch-handle {
left: 74px;
box-shadow: -1px 1px 5px rgba(0, 0, 0, 0.2);
}
/* Transition
========================== */
.switch-label,
.switch-handle {
transition: All 0.3s ease;
-webkit-transition: All 0.3s ease;
-moz-transition: All 0.3s ease;
-o-transition: All 0.3s ease;
}
.switch-yes-no {
padding: 0;
margin: 15px 0 0 auto;
background: #FFF;
border-radius: 0;
background-image: none;
}
.switch-yes-no .switch-label {
box-shadow: none;
background: none;
}
.switch-yes-no .switch-label:after,
.switch-yes-no .switch-label:before {
width: 100%;
height: 70%;
top: 5px;
left: 0;
text-align: center;
padding-top: 10%;
box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.2), inset 0 0 3px rgba(0, 0, 0, 0.1);
}
.switch-yes-no .switch-label:after {
color: #FFFFFF;
background: #32CD32;
backface-visibility: hidden;
transform: rotateY(180deg);
}
.switch-yes-no .switch-label:before {
background: #eceeef;
backface-visibility: hidden;
}
.switch-yes-no .switch-handle {
display: none;
}
.switch-yes-no .switch-input:checked~.switch-label {
background: #FFF;
border-color: #0088cc;
}
.switch-yes-no .switch-input:checked~.switch-label:before {
transform: rotateY(180deg)
}
.switch-yes-no .switch-input:checked~.switch-label:after {
transform: rotateY(0)
}
<div class="mypage">
<div class="row">
<div class="page-header">
<div class="date-dropdown">
<div class="dates-label">
<label for="dropdown">
Choose a date
</label>
</div>
<div class="dates-select">
<select name="dropdown" id="datesid">
<option>option 1</option>
<option>option 2</option>
<option>option 3</option>
</select>
</div>
</div>
<div class="title-wrapper">
<h1>Welcome</h1>
</div>
<div class="toggle-button">
<label class="switch switch-yes-no">
<input class="switch-input" type="checkbox" />
<span class="switch-label" data-on="Yes" data-off="No"></span>
<span class="switch-handle"></span>
</label>
</div>
</div>
</div>
<div class="row">
<div class="table-pie-wrapper">
<div class="table">
i am a table
</div>
<div class="pie-graph">
i am a pie graph
</div>
</div>
</div>
<div class="row">
<div class="table-summary-wrapper">
<div class="table-summary">
i am a table summary
</div>
</div>
</div>
</div>
If you want the whole button to be in the right bottom corner you can use align-self: flex-end:
.toggle-button {
...
align-self: flex-end;
}
Working example:
.mypage {
border: 1px solid black;
}
.row {
margin: 10px;
width: 100%;
}
.page-header {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
border: 1px solid blue;
margin-right: 1vh;
}
.date-dropdown {
border: 1px solid red;
flex-grow: 1;
display: flex;
}
.dates-label {
font-size: large;
font-family: Arial, Helvetica, sans-serif;
}
.dates-select {
margin-left: 1vh;
}
.title-wrapper {
border: 1px solid orange;
flex-grow: 1;
text-align: center;
}
.toggle-button {
border: 1px solid purple;
flex-grow: 1;
align-self: flex-end;
}
/* ============= TOGGLE Button ======= */
.switch {
position: relative;
display: block;
vertical-align: top;
width: 100px;
height: 30px;
padding: 3px;
margin: 0 10px 10px 0;
background: linear-gradient(to bottom, #eeeeee, #FFFFFF 25px);
background-image: -webkit-linear-gradient(top, #eeeeee, #FFFFFF 25px);
border-radius: 18px;
box-shadow: inset 0 -1px white, inset 0 1px 1px rgba(0, 0, 0, 0.05);
cursor: pointer;
box-sizing: content-box;
}
.switch-input {
position: absolute;
top: 0;
left: 0;
opacity: 0;
box-sizing: content-box;
}
.switch-label {
position: relative;
display: block;
height: inherit;
font-size: 10px;
text-transform: uppercase;
background: #eceeef;
border-radius: inherit;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0 2px rgba(0, 0, 0, 0.15);
box-sizing: content-box;
}
.switch-label:before,
.switch-label:after {
position: absolute;
top: 50%;
margin-top: -.5em;
line-height: 1;
-webkit-transition: inherit;
-moz-transition: inherit;
-o-transition: inherit;
transition: inherit;
box-sizing: content-box;
}
.switch-label:before {
content: attr(data-off);
right: 11px;
color: #aaaaaa;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.switch-label:after {
content: attr(data-on);
left: 11px;
color: #FFFFFF;
text-shadow: 0 1px rgba(0, 0, 0, 0.2);
opacity: 0;
}
.switch-input:checked~.switch-label {
background: #E1B42B;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15), inset 0 0 3px rgba(0, 0, 0, 0.2);
}
.switch-input:checked~.switch-label:before {
opacity: 0;
}
.switch-input:checked~.switch-label:after {
opacity: 1;
}
.switch-handle {
position: absolute;
top: 4px;
left: 4px;
width: 28px;
height: 28px;
background: linear-gradient(to bottom, #FFFFFF 40%, #f0f0f0);
background-image: -webkit-linear-gradient(top, #FFFFFF 40%, #f0f0f0);
border-radius: 100%;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
}
.switch-handle:before {
content: "";
position: absolute;
top: 50%;
left: 50%;
margin: -6px 0 0 -6px;
width: 12px;
height: 12px;
background: linear-gradient(to bottom, #eeeeee, #FFFFFF);
background-image: -webkit-linear-gradient(top, #eeeeee, #FFFFFF);
border-radius: 6px;
box-shadow: inset 0 1px rgba(0, 0, 0, 0.02);
}
.switch-input:checked~.switch-handle {
left: 74px;
box-shadow: -1px 1px 5px rgba(0, 0, 0, 0.2);
}
/* Transition
========================== */
.switch-label,
.switch-handle {
transition: All 0.3s ease;
-webkit-transition: All 0.3s ease;
-moz-transition: All 0.3s ease;
-o-transition: All 0.3s ease;
}
.switch-yes-no {
padding: 0;
margin: 15px 0 0;
background: #FFF;
border-radius: 0;
background-image: none;
}
.switch-yes-no .switch-label {
box-shadow: none;
background: none;
}
.switch-yes-no .switch-label:after,
.switch-yes-no .switch-label:before {
width: 100%;
height: 70%;
top: 5px;
left: 0;
text-align: center;
padding-top: 10%;
box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.2), inset 0 0 3px rgba(0, 0, 0, 0.1);
}
.switch-yes-no .switch-label:after {
color: #FFFFFF;
background: #32CD32;
backface-visibility: hidden;
transform: rotateY(180deg);
}
.switch-yes-no .switch-label:before {
background: #eceeef;
backface-visibility: hidden;
}
.switch-yes-no .switch-handle {
display: none;
}
.switch-yes-no .switch-input:checked~.switch-label {
background: #FFF;
border-color: #0088cc;
}
.switch-yes-no .switch-input:checked~.switch-label:before {
transform: rotateY(180deg)
}
.switch-yes-no .switch-input:checked~.switch-label:after {
transform: rotateY(0)
}
<div class="mypage">
<div class="row">
<div class="page-header">
<div class="date-dropdown">
<div class="dates-label">
<label for="dropdown">
Choose a date
</label>
</div>
<div class="dates-select">
<select name="dropdown" id="datesid">
<option>option 1</option>
<option>option 2</option>
<option>option 3</option>
</select>
</div>
</div>
<div class="title-wrapper">
<h1>Welcome</h1>
</div>
<div class="toggle-button">
<label class="switch switch-yes-no">
<input class="switch-input" type="checkbox" />
<span class="switch-label" data-on="Yes" data-off="No"></span>
<span class="switch-handle"></span>
</label>
</div>
</div>
</div>
<div class="row">
<div class="table-pie-wrapper">
<div class="table">
i am a table
</div>
<div class="pie-graph">
i am a pie graph
</div>
</div>
</div>
<div class="row">
<div class="table-summary-wrapper">
<div class="table-summary">
i am a table summary
</div>
</div>
</div>
</div>

Why doesn't my flexbox hover effects work as expected in IE 11?

I have instituted a flex-grid in my code, however its not functioning as expected in ie11 (i unfortunately need to have it work there too)—Chrome and Firefox both work fine. What seems to happen is when I load in IE11—the flex boxes only load 1 per line and are no longer hovering appropriately.
I am honestly at a loss here... anything I change breaks Chrome and Firefox.
.flex_row {
display: flex;
flex-flow: row wrap;
justify-content: space-around;
}
.flex_col{
flex: 1;
margin: 10px;
}
.circle_shape {
position: relative;
display: flex;
padding: 50% 0;
border-radius: 50%;
overflow: hidden;
border: 1px solid gray;
font-size: 16px;
font-family: 'Source Sans Pro', sans-serif;
justify-content: center;
align-items: center;
background: radial-gradient(circle at 50% 120%, #81e8f6, #76deef 10%, #055194 80%, #062745 100%);
}
.circle_shape:before {
content: "";
position: absolute;
top: 1%;
left: 5%;
width: 90%;
height: 90%;
border-radius: 50%;
background: radial-gradient(circle at 50% 0px, #ffffff, rgba(255, 255, 255, 0) 58%);
filter: blur(5px);
z-index: 2;
}
.circle_shape:hover{
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1), 0 1px 2px rgba(0,0,0,0.1);
}
.circle_shape img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.circle_shape i{
position: absolute;
text-align: center;
font-size: 4vw;
text-shadow:
0 0 1px #fff,
0 1px 2px rgba(0,0,0,0.3);
}
.circle_shape h2 {
position: absolute;
bottom: 10%;
font-size: 1vw;
font-weight: 800;
text-align: center;
}
.circle_text{
position: absolute;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0,51,102, 0.9);
border-radius: 50%;
width: 100%;
height: 100%;
overflow: hidden;
opacity: 0;
transition: all 0.4s ease-in-out;
transform: scale(0);
}
.circle_text p {
color: #fff;
padding: 4px;
text-align: center;
font-size: calc(7px + .5vw);
text-shadow:
0 0 1px #fff,
0 1px 2px rgba(0,0,0,0.3);
}
.circle_shape:hover .circle_text{
transform: scale(1);
opacity: 1;
}
<div class="flex_row">
<a class="flex_col" href="http://www.cnn.com">
<div class="circle_shape">
<i class="fas fa-sitemap"></i>
<div class="circle_text">
<p>Load me some CNN!</p>
</div>
</div>
<div>
<h2>Beep!</h2>
</div>
</a>
<a class="flex_col" href="http://www.cnn.com">
<div class="circle_shape">
<i class="fas fa-sitemap"></i>
<div class="circle_text">
<p>Load me some ABC!</p>
</div>
</div>
<div>
<h2>BIP!</h2>
</div>
</a>
<a class="flex_col" href="http://www.cnn.com">
<div class="circle_shape">
<i class="fas fa-sitemap"></i>
<div class="circle_text">
<p>Load me some BBC!</p>
</div>
</div>
<div>
<h2>BOOP!</h2>
</div>
</a>
</div>
JSFiddle link
IE 11 partially support flex box. Partial support due to large amount of bugs.
Visit the link for more information.
I try to test with the code in IE 11 and try to modify it for testing purpose. I tried many variations in the code but nothing worked so far.
As a work around, I suggest you to refer example below which is working properly in IE and other browsers.
.ch-item {
width: 100%;
height: 100%;
border-radius: 50%;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 0 rgba(200, 95, 66, 0.4), inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.1);
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
z-index: 2;
}
.ch-info {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-backface-visibility: hidden;
}
li {
position: relative;
overflow: hidden;
border-radius: 100%;
}
li img {
position: absolute;
top: 0;
left: 0;
z-index: 1;
}
.ch-info h3 {
color: #fff;
text-transform: uppercase;
position: relative;
letter-spacing: 2px;
font-size: 22px;
margin: 0 30px;
padding: 65px 0 0 0;
height: 110px;
font-family: 'Open Sans', Arial, sans-serif;
text-shadow: 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.3);
}
.ch-info p {
color: #fff;
padding: 10px 5px;
font-style: italic;
margin: 0 30px;
font-size: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.5);
}
.ch-info p a {
display: block;
color: #fff;
color: rgba(255, 255, 255, 0.7);
font-style: normal;
font-weight: 700;
text-transform: uppercase;
font-size: 9px;
letter-spacing: 1px;
padding-top: 4px;
font-family: 'Open Sans', Arial, sans-serif;
}
.ch-info p a:hover {
color: #fff222;
color: rgba(255, 242, 34, 0.8);
}
.ch-item:hover {
box-shadow: inset 0 0 0 110px rgba(200, 95, 66, 0.4), inset 0 0 0 16px rgba(255, 255, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.ch-item:hover .ch-info {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
#import url('normalize.css');
/* General Demo Style */
body{
font-family: Cambria, Georgia, serif;
background: #f9f9f9 url(../images/bg.jpg);
font-weight: 300;
font-size: 15px;
color: #333;
-webkit-font-smoothing: antialiased;
overflow-y: scroll;
overflow-x: hidden;
}
a{
color: #555;
text-decoration: none;
}
.container{
width: 100%;
position: relative;
}
.clr{
clear: both;
padding: 0;
height: 0;
margin: 0;
}
.main{
width: 90%;
margin: 0 auto;
position: relative;
}
.container > header{
margin: 10px;
padding: 20px 10px 10px 10px;
position: relative;
display: block;
text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
text-align: center;
}
.container > header h1{
font-size: 32px;
line-height: 32px;
margin: 0;
position: relative;
font-weight: 300;
color: #777;
text-shadow: 1px 1px 1px rgba(255,255,255,0.7);
}
.container > header h2{
font-size: 14px;
font-weight: 300;
font-style: italic;
margin: 0;
padding: 15px 0 5px 0;
color: #888;
text-shadow: 1px 1px 1px rgba(255,255,255,0.9);
}
/* Header Style */
.codrops-top{
line-height: 24px;
font-size: 11px;
background: #fff;
background: rgba(255, 255, 255, 0.6);
text-transform: uppercase;
z-index: 9999;
position: relative;
box-shadow: 1px 0px 2px rgba(0,0,0,0.1);
}
.codrops-top a{
padding: 0px 10px;
letter-spacing: 1px;
color: #333;
display: inline-block;
}
.codrops-top a:hover{
background: rgba(255,255,255,0.3);
}
.codrops-top span.right{
float: right;
}
.codrops-top span.right a{
float: left;
display: block;
}
/* Demo Buttons Style */
.codrops-demos{
text-align:center;
display: block;
line-height: 30px;
padding: 5px 0px;
}
.codrops-demos a{
display: inline-block;
font-style: italic;
margin: 0px 4px;
padding: 0px 6px;
color: #aaa;
line-height: 20px;
font-size: 13px;
text-shadow: 1px 1px 1px #fff;
border: 1px solid #fff;
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(47%,#f6f6f6), color-stop(100%,#ededed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* IE10+ */
background: linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
.codrops-demos a:hover{
color: #333;
background: #fff;
}
.codrops-demos a:active{
background: #fff;
}
.codrops-demos a.current-demo,
.codrops-demos a.current-demo:hover{
background: #f0f0f0;
border-color: #d9d9d9;
color: #aaa;
box-shadow: 0 1px 1px rgba(255,255,255,0.7);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f6f6f6', endColorstr='#f6f6f6',GradientType=0 ); /* IE6-9 */
}
.support-note span{
color: #ac375d;
font-size: 16px;
display: none;
font-weight: bold;
text-align: center;
padding: 5px 0;
}
.no-cssanimations .support-note span.no-cssanimations,
.no-csstransforms .support-note span.no-csstransforms,
.no-csstransforms3d .support-note span.no-csstransforms3d,
.no-csstransitions .support-note span.no-csstransitions{
display: block;
}
.ch-grid {
margin: 20px 0 0 0;
padding: 0;
list-style: none;
display: block;
text-align: center;
width: 100%;
}
.ch-grid:after,
.ch-item:before {
content: '';
display: table;
}
.ch-grid:after {
clear: both;
}
.ch-grid li {
width: 220px;
height: 220px;
display: inline-block;
margin: 20px;
}
<section class="main">
<ul class="ch-grid">
<li>
<img src="http://tympanus.net/Tutorials/CircleHoverEffects/images/5.jpg" alt="Vision">
<div class="ch-item">
<div class="ch-info">
<h3>Brainiac</h3>
<p>by Daniel Nyari View on Dribbble</p>
</div>
</div>
</li>
</ul>
</section>
Output in IE:
References:
(1) JSFiddle link
(2) Circle Hover Effects with CSS Transitions
Further, you can try to modify the code example as per your requirement.
I just wanted to follow up on this. Rather than rewrite my code -- I decided to hack around it to define a solution.
First step was to identify this is IE 10+ code in my CSS -- i did that through:
#media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */
}
I then redefined my flex_container and flex_item as block (using column code as follows) inside the #media query
[class*="flex_item"] {
float: left;
padding: 15px;
}
.flex_container{
display: block;
overflow: hidden;
box-sizing: border-box;
justify-content: center;
align-items: center;
text-align: center;
flex-direction: none;
font-size: 16px;
}
.flex_item {width: 8.33%;box-sizing: border-box;}
I then went through my code and changed any reference to flex to block within that code. Its a lot of duplication but it essentially got me back to #deepak-MSFTs response.
This effectively resolves my issue.

Adjust gap between menu

I'm trying to adjust the spacing(gap) between menu so it'll fit with the navbar.By changing margin doesn't seems to do it. Anyone have idea on how to fix this ? Is it possible to re-position each menu individually ?
Here's the demo
#navbar {
width: 1200px;
height: 180px;
background: url(http://i67.tinypic.com/5cygax.png) no-repeat center center;
background-size: contain;
-webkit-background-size: contain;
-moz-background-size: contain;
-o-background-size: contain;
background-size: contain;
margin-left: 80px;
margin-top: 100px;
}
#menu {
display: inline-block;
margin: 65px 50px 0px 100px;
position: relative;
float: left;
width: 100px;
padding: 0 10px;
border-radius: 8px;
box-shadow: inset 0 1px 1px rgba(255, 255, 255, .5), inset 0 -1px 0 rgba(0, 0, 0, .15), 0 1px 3px rgba(0, 0, 0, .15);
background: #8495F5;
}
#menu,
#menu ul {
list-style: none;
}
#menu: li {
float: left;
position: relative;
border-right: 1px solid rgba(0, 0, 0, .1);
box-shadow: 1px 0 0 rgba(255, 255, 255, .25);
perspective: 1000px;
}
#menu: li:first-child {
border-left: 1px solid rgba(255, 255, 255, .25);
box-shadow: -1px 0 0 rgba(0, 0, 0, .1), 1px 0 0 rgba(255, 255, 255, .25);
}
#menu a {
display: block;
position: inherit;
z-index: 10;
padding: 15px 20px 15px 20px;
text-decoration: none;
color: rgba(75, 75, 75, 1);
line-height: 1;
font-family: sans-serif;
font-weight: 700;
font-size: 12px;
letter-spacing: 0.15em;
background: transparent;
text-shadow: 0 1px 1px rgba(255, 255, 255, .9);
transition: all .25s ease-in-out;
text-align: center;
}
#menu: li:hover>a {
background: #333;
color: rgba(0, 223, 252, 1);
text-shadow: none;
}
#menu li ul {
position: absolute;
left: 0;
z-index: 1;
width: 250px;
padding: 0;
opacity: 0;
visibility: hidden;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
background: transparent;
overflow: hidden;
transform-origin: 50% 0%;
}
#menu li:hover ul {
padding: 5px 0;
background: #333;
opacity: 1;
visibility: visible;
box-shadow: 1px 1px 7px rgba(0, 0, 0, .5);
animation-name: swingdown;
animation-duration: 1s;
animation-timing-function: ease;
}
#keyframes swingdown {
0% {
opacity: .99999;
transform: rotateX(90deg);
}
30% {
transform: rotateX(-20deg) rotateY(5deg);
animation-timing-function: ease-in-out;
}
65% {
transform: rotateX(20deg) rotateY(-3deg);
animation-timing-function: ease-in-out;
}
100% {
transform: rotateX(0);
animation-timing-function: ease-in-out;
}
}
#menu li li a {
padding-left: 15px;
font-weight: 400;
color: #ddd;
text-shadow: none;
border-top: dotted 1px transparent;
border-bottom: dotted 1px transparent;
transition: all .15s linear;
}
#menu li li a:hover {
color: rgba(0, 223, 252, 1);
border-top: dotted 1px rgba(255, 255, 255, .15);
border-bottom: dotted 1px rgba(255, 255, 255, .15);
background: rgba(0, 223, 252, .02);
}
<div id="container">
<div id="navbar">
<ul id="menu">
<li><a class="home" href="#">Home</a></li>
</ul>
<ul id="menu">
<li><a class="register" href="#">Register</a></li>
</ul>
<ul id="menu">
<li><a class="guide" href="#">Guide</a>
<ul>
<li>New Features</li>
<li>Quest & Event Guide</li>
<li>Brigand & T-map Guide</li>
</ul>
</ul>
<ul id="menu">
<li><a class="download" href="#">Download</a>
<ul>
<li>Patch Download</li>
</ul>
</ul>
</div>
</div>
I am guessing you want something like this?
The last lines in the CSS will control each LI position.
SOURCE:
#navbar{
width: 1200px;
height: 180px;
background: url(http://i67.tinypic.com/5cygax.png) no-repeat center center;
background-size: contain;
-webkit-background-size: contain;
-moz-background-size: contain;
-o-background-size: contain;
background-size: contain;
margin-left: 80px;
margin-top: 100px;
}
ul#menu {
display: inline-block;
margin: 65px 0 0px 195px;
position: relative;
width: 800px;
list-style-type:none;
}
ul#menu, ul#menu-sub {
list-style-type: none;
}
ul#menu > li {
padding: 0 10px;
box-shadow: inset 0 1px 1px rgba(255,255,255,.5), inset 0 -1px 0 rgba(0,0,0,.15), 0 1px 3px rgba(0,0,0,.15);
background: #8495F5;
width: 100px;
float: left;
position: relative;
display: inline-block;
border-right: 1px solid rgba(0,0,0,.1);
box-shadow: 1px 0 0 rgba(255,255,255,.25);
border-radius: 8px;
}
#menu li:first-child {
border-left: 1px solid rgba(255,255,255,.25);
box-shadow: -1px 0 0 rgba(0,0,0,.1), 1px 0 0 rgba(255,255,255,.25);
}
#menu a.menu-top {
display: block;
position: inherit;
z-index: 10;
padding: 15px 20px 15px 20px;
text-decoration: none;
color: rgba(75,75,75,1);
line-height: 1;
font-family: sans-serif;
font-weight: 700;
font-size: 12px;
letter-spacing: 0.15em;
background: transparent;
text-shadow: 0 1px 1px rgba(255,255,255,.9);
transition: all .25s ease-in-out;
text-align: center;
}
#menu-sub {
position: absolute;
left: 0;
z-index: 1;
width: 250px;
padding: 0;
opacity: 0;
visibility: hidden;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
background: transparent;
overflow: hidden;
transform-origin: 50% 0%;
}
#menu-sub a {
padding-left: 15px;
font-weight: 400;
color: #ddd;
text-shadow: none;
border-top: dotted 1px transparent;
border-bottom: dotted 1px transparent;
transition: all .15s linear;
padding: 10px;
display:block;
}
#menu-sub a:hover {
color: rgba(0,223,252,1);
border-top: dotted 1px rgba(255,255,255,.15);
border-bottom: dotted 1px rgba(255,255,255,.15);
background: rgba(0,223,252,.02);
}
#menu-sub li:hover > a {
background: #333;
color: rgba(0,223,252,1);
text-shadow: none;
}
#menu li:hover #menu-sub {
padding: 5px 0;
background: #333;
opacity: 1;
visibility: visible;
box-shadow: 1px 1px 7px rgba(0,0,0,.5);
animation-name: swingdown;
animation-duration: 1s;
animation-timing-function: ease;
}
#keyframes swingdown {
0% {
opacity: .99999;
transform: rotateX(90deg);
}
30% {
transform: rotateX(-20deg) rotateY(5deg);
animation-timing-function: ease-in-out;
}
65% {
transform: rotateX(20deg) rotateY(-3deg);
animation-timing-function: ease-in-out;
}
100% {
transform: rotateX(0);
animation-timing-function: ease-in-out;
}
}
/* controlling each li's position */
ul#menu li:nth-child(1) { /*first */
margin-right: 3%
}
ul#menu li:nth-child(2) { /*first */
margin-right: 200px;
}
ul#menu li:nth-child(3) { /*first */
margin-right: 3%
}
ul#menu li:nth-child(4) { /*first */
margin-right: 0;
}
<div id="container">
<div id="navbar">
<ul id="menu">
<li><a class="menu-top home" href="#">Home</a></li>
<li><a class="menu-top register" href="#">Register</a></li>
<li>
<a class="menu-top guide" href="#">Guide</a>
<ul id="menu-sub">
<li>New Features</li>
<li>Quest & Event Guide</li>
<li>Brigand & T-map Guide</li>
</ul>
</li>
<li>
<a class="menu-top download" href="#">Download</a>
<ul id="menu-sub">
<li>Patch Download</li>
</ul>
</li>
</ul>
</div>
</div>
View Pen: Adjust gap between menu
Changed margin for #menu
#menu {
margin: 65px 0 0px 20px;
}
#navbar {
width: 1200px;
height: 180px;
background: url(http://i67.tinypic.com/5cygax.png) no-repeat center center;
background-size: contain;
-webkit-background-size: contain;
-moz-background-size: contain;
-o-background-size: contain;
background-size: contain;
margin-left: 80px;
margin-top: 100px;
}
#menu {
display: inline-block;
margin: 65px 0 0px 20px;
position: relative;
float: left;
width: 100px;
padding: 0 10px;
border-radius: 8px;
box-shadow: inset 0 1px 1px rgba(255, 255, 255, .5), inset 0 -1px 0 rgba(0, 0, 0, .15), 0 1px 3px rgba(0, 0, 0, .15);
background: #8495F5;
}
#menu,
#menu ul {
list-style: none;
}
#menu: li {
float: left;
position: relative;
border-right: 1px solid rgba(0, 0, 0, .1);
box-shadow: 1px 0 0 rgba(255, 255, 255, .25);
perspective: 1000px;
}
#menu: li:first-child {
border-left: 1px solid rgba(255, 255, 255, .25);
box-shadow: -1px 0 0 rgba(0, 0, 0, .1), 1px 0 0 rgba(255, 255, 255, .25);
}
#menu a {
display: block;
position: inherit;
z-index: 10;
padding: 15px 20px 15px 20px;
text-decoration: none;
color: rgba(75, 75, 75, 1);
line-height: 1;
font-family: sans-serif;
font-weight: 700;
font-size: 12px;
letter-spacing: 0.15em;
background: transparent;
text-shadow: 0 1px 1px rgba(255, 255, 255, .9);
transition: all .25s ease-in-out;
text-align: center;
}
#menu: li:hover>a {
background: #333;
color: rgba(0, 223, 252, 1);
text-shadow: none;
}
#menu li ul {
position: absolute;
left: 0;
z-index: 1;
width: 250px;
padding: 0;
opacity: 0;
visibility: hidden;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
background: transparent;
overflow: hidden;
transform-origin: 50% 0%;
}
#menu li:hover ul {
padding: 5px 0;
background: #333;
opacity: 1;
visibility: visible;
box-shadow: 1px 1px 7px rgba(0, 0, 0, .5);
animation-name: swingdown;
animation-duration: 1s;
animation-timing-function: ease;
}
#keyframes swingdown {
0% {
opacity: .99999;
transform: rotateX(90deg);
}
30% {
transform: rotateX(-20deg) rotateY(5deg);
animation-timing-function: ease-in-out;
}
65% {
transform: rotateX(20deg) rotateY(-3deg);
animation-timing-function: ease-in-out;
}
100% {
transform: rotateX(0);
animation-timing-function: ease-in-out;
}
}
#menu li li a {
padding-left: 15px;
font-weight: 400;
color: #ddd;
text-shadow: none;
border-top: dotted 1px transparent;
border-bottom: dotted 1px transparent;
transition: all .15s linear;
}
#menu li li a:hover {
color: rgba(0, 223, 252, 1);
border-top: dotted 1px rgba(255, 255, 255, .15);
border-bottom: dotted 1px rgba(255, 255, 255, .15);
background: rgba(0, 223, 252, .02);
}
<div id="container">
<div id="navbar">
<ul id="menu">
<li><a class="home" href="#">Home</a></li>
</ul>
<ul id="menu">
<li><a class="register" href="#">Register</a></li>
</ul>
<ul id="menu">
<li><a class="guide" href="#">Guide</a>
<ul>
<li>New Features</li>
<li>Quest & Event Guide</li>
<li>Brigand & T-map Guide</li>
</ul>
</ul>
<ul id="menu">
<li><a class="download" href="#">Download</a>
<ul>
<li>Patch Download</li>
</ul>
</ul>
</div>
</div>

Header isn't centered but rest of the page is

Been trying to figure out for a couple of days now why the logo in the header which you can see here: https://gyazo.com/5eb973585ce428f9d34bc7bd46aec14c isn't centered with the rest of the page like with the arrow below it in the picture.
#font-face {
font-family: 'cabinregular';
src: url('font1/cabin-regular-webfont.woff2') format('woff2'), url('font1/cabin-regular-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: 'open_sansregular';
src: url(font2/opensans-regular-webfont.woff2) format("woff2"), url(font2/opensans-regular-webfont.woff) format("woff");
font-weight: 400;
font-style: normal;
}
#font-face {
font-family: 'edoregular';
src: url(font3/edo-webfont.woff2) format("woff2"), url(font3/edo-webfont.woff) format("woff");
font-weight: 400;
font-style: normal;
}
body {
margin: 0;
padding: 0;
}
.header {
background-color: white;
width: 100%;
height: 70px;
position: fixed;
z-index: 999;
-webkit-box-shadow: 0px -1px 16px -5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0px -1px 16px -5px rgba(0, 0, 0, 0.75);
box-shadow: 0px -1px 16px -5px rgba(0, 0, 0, 0.75);
}
.headeritems {
text-align: center;
}
.navigationleft {
vertical-align: top;
display: inline-block;
}
.navigationleft ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.navigationleft li {
display: inline;
}
.navigationleft li a {
color: #BEBEBE;
display: inline-block;
padding: 24px 40px 0px 40px;
text-decoration: none;
font-family: cabinregular;
font-size: 16px;
transition: color .20s ease-in-out;
-moz-transition: color .20s ease-in-out;
-webkit-transition: color .20s ease-in-out;
}
.navigationleft li a:hover {
color: #00C4FF;
}
.logo {
display: inline-block;
padding: 10px 20px 0px 20px;
}
.navigationright {
vertical-align: top;
display: inline-block;
}
.navigationright ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.navigationright li {
display: inline;
}
.navigationright li a {
color: #BEBEBE;
display: inline-block;
padding: 24px 40px 0px 40px;
text-decoration: none;
font-family: cabinregular;
font-size: 16px;
transition: color .20s ease-in-out;
-moz-transition: color .20s ease-in-out;
-webkit-transition: color .20s ease-in-out;
}
.navigationright li a:hover {
color: #00C4FF;
}
.container {
background-image: url(images/container.jpg);
background-repeat: no-repeat;
width: cover;
height: 650px;
}
.content {
margin: 0 auto;
width: 650px;
padding-top: 250px;
color: white;
font-family: edoregular;
font-size: 100px;
text-shadow: 3px 2px 1px rgba(0, 0, 0, 0.5);
}
.arrow1 {
margin: 0 auto;
width: 60px;
margin-top: 170px;
transition: padding-top .20s ease-in-out;
-moz-transition: padding-top .20s ease-in-out;
-webkit-transition: padding-top .20s ease-in-out;
}
.arrow1:hover {
padding-top: 20px;
}
.contentabout {
margin: 0 auto;
width: 650px;
height: 550px;
padding-top: 100px;
font-family: edoregular;
text-align: justify;
}
.contentabout h1 {
height: 50px;
color: #2D2D2D;
border-bottom: 1px solid #EEEEEE;
}
.contentabout p {
padding-top: 30px;
font-family: open_sansregular;
font-size: 15px;
}
.arrow2 {
margin: 0 auto;
width: 60px;
margin-top: 145px;
transition: padding-top .20s ease-in-out;
-moz-transition: padding-top .20s ease-in-out;
-webkit-transition: padding-top .20s ease-in-out;
}
.arrow2:hover {
padding-top: 20px;
}
.containerportfolio {
height: 720px;
background-image: url(images/containerportfolio.jpg);
}
.contentportfolio {
margin: 0 auto;
width: 709px;
padding-top: 70px;
font-family: edoregular;
color: white;
text-shadow: 3px 2px 1px rgba(0, 0, 0, 0.5);
}
.contentportfolio h1 {
height: 50px;
border-bottom: 1px solid white;
}
.portfolioitems {
height: 400px;
border-bottom: 1px solid white;
}
.portfolioitems p {
text-align: center;
font-family: open_sansregular;
font-size 30px;
color: white;
padding-top: 100px;
}
.byggfram {
width: 220px;
height: 124px;
opacity: 0.7;
display: inline-block;
margin-top: 5px;
-webkit-box-shadow: 0px 0px 56px -1px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0px 0px 56px -1px rgba(0, 0, 0, 0.75);
box-shadow: 0px 0px 56px -1px rgba(0, 0, 0, 0.75);
transition: opacity .20s ease-in-out;
-moz-transition: opacity .20s ease-in-out;
-webkit-transition: opacity .20s ease-in-out;
}
.byggfram:hover {
opacity: 1;
}
.classie {
width: 220px;
height: 124px;
opacity: 0.7;
display: inline-block;
margin-left: 20px;
-webkit-box-shadow: 0px 0px 56px -1px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0px 0px 56px -1px rgba(0, 0, 0, 0.75);
box-shadow: 0px 0px 56px -1px rgba(0, 0, 0, 0.75);
transition: opacity .20s ease-in-out;
-moz-transition: opacity .20s ease-in-out;
-webkit-transition: opacity .20s ease-in-out;
}
.classie:hover {
opacity: 1;
}
.anderssonsvensson {
width: 220px;
height: 124px;
opacity: 0.7;
display: inline-block;
margin-left: 20px;
-webkit-box-shadow: 0px 0px 56px -1px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0px 0px 56px -1px rgba(0, 0, 0, 0.75);
box-shadow: 0px 0px 56px -1px rgba(0, 0, 0, 0.75);
transition: opacity .20s ease-in-out;
-moz-transition: opacity .20s ease-in-out;
-webkit-transition: opacity .20s ease-in-out;
}
.anderssonsvensson:hover {
opacity: 1;
}
.arrow3 {
margin: 0 auto;
width: 60px;
margin-top: 85px;
transition: padding-top .20s ease-in-out;
-moz-transition: padding-top .20s ease-in-out;
-webkit-transition: padding-top .20s ease-in-out;
}
.arrow3:hover {
padding-top: 20px;
}
.containercontact {
height: 650px;
}
.contact {
margin: 0 auto;
width: 650px;
padding-top: 70px;
}
.titlecontact {
text-align: center;
}
.contact h1 {
font-family: edoregular;
color: #2D2D2D;
height: 50px;
}
<!DOCTYPE html>
<html>
<head>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<link href="css/style.css" rel="stylesheet">
<link href="css/images/favicon.ico" rel="shortcut icon">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Loom | Home</title>
</head>
<body>
<a id="home" name="home"></a>
<a id="home" name="top"></a>
<div class="header">
<div class="headeritems">
<div class="navigationleft">
<ul>
<li>
Home
</li>
<li>
About
</li>
</ul>
</div>
<div class="logo">
<a href="#home">
<img src="css/images/loomlogo.svg">
</a>
</div>
<div class="navigationright">
<ul>
<li>
Portfolio
</li>
<li>
Contact
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="content">
Loom Is Lemon
<div class="arrow1">
<a href="#about" class="smoothScroll">
<img src="css/images/arrowdown.svg" style="width:60px">
</a>
</div>
</div>
</div>
<a id="about" name="about"></a>
<div class="containerabout">
<div class="contentabout">
<h1>Greetings from Sweden!</h1>
<p>Hello</p>
<div class="arrow2">
<a href="#portfolio" class="smoothScroll">
<img src="css/images/arrowdown2.svg" style="width:60px">
</a>
</div>
</div>
</div>
<a id="portfolio" name="portfolio"></a>
<div class="containerportfolio">
<div class="contentportfolio">
<h1>Portfolio</h1>
<div class="portfolioitems">
<div class="byggfram">
<img src="css/images/byggfram.png">
</div>
<div class="classie">
<img src="css/images/classie.png">
</div>
<div class="anderssonsvensson">
<img src="css/images/anderssonsvensson.png">
</div>
<p>More coming soon!</p>
</div>
<div class="arrow3">
<a href="#contact" class="smoothScroll">
<img src="css/images/arrowdown.svg" style="width:60px">
</a>
</div>
</div>
</div>
<div class="containercontact">
<div class="contact">
<div class="titlecontact">
<img src="css/images/loomlogo2.svg">
<h1>Contact Me!</h1>
</div>
</div>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="javascript/smoothscroll.js"></script>
</body>
You could try putting:
<center></center>
around the part that isn't centered.

How to get Circle Hover Effects with CSS Transitions with img tag?

I want Circle Hover Effects with CSS Transitions on <img> tag without calling the image as background image.
I have created a JSFiddle of the effect I want. But in this fiddle, image is used as a background image. I want same effect, but with image in an img tag, not as background image.
.ch-item {
width: 100%;
height: 100%;
border-radius: 50%;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 0 rgba(200, 95, 66, 0.4), inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.1);
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
}
.ch-img-1 {
background-image: url(http://tympanus.net/Tutorials/CircleHoverEffects/images/5.jpg);
}
.ch-img-2 {
background-image: url(http://tympanus.net/Tutorials/CircleHoverEffects/images/5.jpg);
}
.ch-img-3 {
background-image: url(http://tympanus.net/Tutorials/CircleHoverEffects/images/5.jpg);
}
.ch-info {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-backface-visibility: hidden;
}
.ch-info h3 {
color: #fff;
text-transform: uppercase;
position: relative;
letter-spacing: 2px;
font-size: 22px;
margin: 0 30px;
padding: 65px 0 0 0;
height: 110px;
font-family: 'Open Sans', Arial, sans-serif;
text-shadow: 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.3);
}
.ch-info p {
color: #fff;
padding: 10px 5px;
font-style: italic;
margin: 0 30px;
font-size: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.5);
}
.ch-info p a {
display: block;
color: #fff;
color: rgba(255, 255, 255, 0.7);
font-style: normal;
font-weight: 700;
text-transform: uppercase;
font-size: 9px;
letter-spacing: 1px;
padding-top: 4px;
font-family: 'Open Sans', Arial, sans-serif;
}
.ch-info p a:hover {
color: #fff222;
color: rgba(255, 242, 34, 0.8);
}
.ch-item:hover {
box-shadow: inset 0 0 0 110px rgba(200, 95, 66, 0.4), inset 0 0 0 16px rgba(255, 255, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.ch-item:hover .ch-info {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
#import url('normalize.css');
/* General Demo Style */
body {
font-family: Cambria, Georgia, serif;
background: #f9f9f9 url(../images/bg.jpg);
font-weight: 300;
font-size: 15px;
color: #333;
-webkit-font-smoothing: antialiased;
overflow-y: scroll;
overflow-x: hidden;
}
a {
color: #555;
text-decoration: none;
}
.container {
width: 100%;
position: relative;
}
.clr {
clear: both;
padding: 0;
height: 0;
margin: 0;
}
.main {
width: 90%;
margin: 0 auto;
position: relative;
}
.container > header {
margin: 10px;
padding: 20px 10px 10px 10px;
position: relative;
display: block;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
text-align: center;
}
.container > header h1 {
font-size: 32px;
line-height: 32px;
margin: 0;
position: relative;
font-weight: 300;
color: #777;
text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.7);
}
.container > header h2 {
font-size: 14px;
font-weight: 300;
font-style: italic;
margin: 0;
padding: 15px 0 5px 0;
color: #888;
text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.9);
}
/* Header Style */
.codrops-top {
line-height: 24px;
font-size: 11px;
background: #fff;
background: rgba(255, 255, 255, 0.6);
text-transform: uppercase;
z-index: 9999;
position: relative;
box-shadow: 1px 0px 2px rgba(0, 0, 0, 0.1);
}
.codrops-top a {
padding: 0px 10px;
letter-spacing: 1px;
color: #333;
display: inline-block;
}
.codrops-top a:hover {
background: rgba(255, 255, 255, 0.3);
}
.codrops-top span.right {
float: right;
}
.codrops-top span.right a {
float: left;
display: block;
}
/* Demo Buttons Style */
.codrops-demos {
text-align: center;
display: block;
line-height: 30px;
padding: 5px 0px;
}
.codrops-demos a {
display: inline-block;
font-style: italic;
margin: 0px 4px;
padding: 0px 6px;
color: #aaa;
line-height: 20px;
font-size: 13px;
text-shadow: 1px 1px 1px #fff;
border: 1px solid #fff;
background: #ffffff;
/* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(47%, #f6f6f6), color-stop(100%, #ededed));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
/* IE10+ */
background: linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
/* W3C */
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed', GradientType=0);
/* IE6-9 */
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
.codrops-demos a:hover {
color: #333;
background: #fff;
}
.codrops-demos a:active {
background: #fff;
}
.codrops-demos a.current-demo,
.codrops-demos a.current-demo:hover {
background: #f0f0f0;
border-color: #d9d9d9;
color: #aaa;
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#f6f6f6', endColorstr='#f6f6f6', GradientType=0);
/* IE6-9 */
}
.support-note span {
color: #ac375d;
font-size: 16px;
display: none;
font-weight: bold;
text-align: center;
padding: 5px 0;
}
.no-cssanimations .support-note span.no-cssanimations,
.no-csstransforms .support-note span.no-csstransforms,
.no-csstransforms3d .support-note span.no-csstransforms3d,
.no-csstransitions .support-note span.no-csstransitions {
display: block;
}
.ch-grid {
margin: 20px 0 0 0;
padding: 0;
list-style: none;
display: block;
text-align: center;
width: 100%;
}
.ch-grid:after,
.ch-item:before {
content: '';
display: table;
}
.ch-grid:after {
clear: both;
}
.ch-grid li {
width: 220px;
height: 220px;
display: inline-block;
margin: 20px;
}
<section class="main">
<ul class="ch-grid">
<li>
<div class="ch-item ch-img-1">
<div class="ch-info">
<h3>Brainiac</h3>
<p>by Daniel Nyari View on Dribbble
</p>
</div>
</div>
</li>
<li>
<div class="ch-item ch-img-2">
<div class="ch-info">
<h3>Vision</h3>
<p>by Daniel Nyari View on Dribbble
</p>
</div>
</div>
</li>
<li>
<div class="ch-item ch-img-3">
<div class="ch-info">
<h3>Cylon</h3>
<p>by Daniel Nyari View on Dribbble
</p>
</div>
</div>
</li>
</ul>
</section>
I've edited your fiddle here: http://jsfiddle.net/pedwf80h/7/
Essentially I've moved the img url from the background to within the li element. Then positioned the img absolutely and used z-index to move it to the back. The li element then uses overflow: hidden and border-radius: 100% to hide any of the image that goes outside of our li element.
Hope this helps!
Try this may be this can help for you:
.ch-item {
width: 100%;
height: 100%;
border-radius: 50%;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 0 rgba(200, 95, 66, 0.4), inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.1);
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
z-index: 2;
}
.ch-info {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-backface-visibility: hidden;
}
li {
position: relative;
overflow: hidden;
border-radius: 100%;
}
li img {
position: absolute;
top: 0;
left: 0;
z-index: 1;
}
.ch-item:hover {
box-shadow: inset 0 0 0 110px rgba(200, 95, 66, 0.4), inset 0 0 0 16px rgba(255, 255, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.ch-item:hover .ch-info {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
#import url('normalize.css');
/* General Demo Style */
body{
font-family: Cambria, Georgia, serif;
background: #f9f9f9 url(../images/bg.jpg);
font-weight: 300;
font-size: 15px;
color: #333;
-webkit-font-smoothing: antialiased;
overflow-y: scroll;
overflow-x: hidden;
}
a{
color: #555;
text-decoration: none;
}
.container{
width: 100%;
position: relative;
}
.clr{
clear: both;
padding: 0;
height: 0;
margin: 0;
}
.main{
width: 90%;
margin: 0 auto;
position: relative;
}
.container > header{
margin: 10px;
padding: 20px 10px 10px 10px;
position: relative;
display: block;
text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
text-align: center;
}
.container > header h1{
font-size: 32px;
line-height: 32px;
margin: 0;
position: relative;
font-weight: 300;
color: #777;
text-shadow: 1px 1px 1px rgba(255,255,255,0.7);
}
.container > header h2{
font-size: 14px;
font-weight: 300;
font-style: italic;
margin: 0;
padding: 15px 0 5px 0;
color: #888;
text-shadow: 1px 1px 1px rgba(255,255,255,0.9);
}
/* Header Style */
.codrops-top{
line-height: 24px;
font-size: 11px;
background: #fff;
background: rgba(255, 255, 255, 0.6);
text-transform: uppercase;
z-index: 9999;
position: relative;
box-shadow: 1px 0px 2px rgba(0,0,0,0.1);
}
.codrops-top a{
padding: 0px 10px;
letter-spacing: 1px;
color: #333;
display: inline-block;
}
.codrops-top a:hover{
background: rgba(255,255,255,0.3);
}
.codrops-top span.right{
float: right;
}
.codrops-top span.right a{
float: left;
display: block;
}
/* Demo Buttons Style */
.codrops-demos{
text-align:center;
display: block;
line-height: 30px;
padding: 5px 0px;
}
.codrops-demos a{
display: inline-block;
font-style: italic;
margin: 0px 4px;
padding: 0px 6px;
color: #aaa;
line-height: 20px;
font-size: 13px;
text-shadow: 1px 1px 1px #fff;
border: 1px solid #fff;
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(47%,#f6f6f6), color-stop(100%,#ededed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* IE10+ */
background: linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
.codrops-demos a:hover{
color: #333;
background: #fff;
}
.codrops-demos a:active{
background: #fff;
}
.codrops-demos a.current-demo,
.codrops-demos a.current-demo:hover{
background: #f0f0f0;
border-color: #d9d9d9;
color: #aaa;
box-shadow: 0 1px 1px rgba(255,255,255,0.7);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f6f6f6', endColorstr='#f6f6f6',GradientType=0 ); /* IE6-9 */
}
.support-note span{
color: #ac375d;
font-size: 16px;
display: none;
font-weight: bold;
text-align: center;
padding: 5px 0;
}
.no-cssanimations .support-note span.no-cssanimations,
.no-csstransforms .support-note span.no-csstransforms,
.no-csstransforms3d .support-note span.no-csstransforms3d,
.no-csstransitions .support-note span.no-csstransitions{
display: block;
}
.ch-grid {
margin: 20px 0 0 0;
padding: 0;
list-style: none;
display: block;
text-align: center;
width: 100%;
}
.ch-grid:after,
.ch-item:before {
content: '';
display: table;
}
.ch-grid:after {
clear: both;
}
.ch-grid li {
width: 220px;
height: 220px;
display: inline-block;
margin: 20px;
}
<section class="main">
<ul class="ch-grid">
<li>
<img src="http://tympanus.net/Tutorials/CircleHoverEffects/images/5.jpg" alt="Vision">
<div class="ch-item">
<div class="ch-info">
</div>
</div>
</li>
</ul>
</section>
Additional reference website...
Reference link
#import url(http://fonts.googleapis.com/css?family=Cabin:700);
body {
padding-top: 2em;
background-color: #c02227;
}
.circle-container {
position: relative;
perspective: 1000;
margin: 0 auto;
}
.circle-container:hover .circle {
transform: rotate3d(45, 45, 0, 180deg);
}
.circle-container:hover .outer-ring {
transform: rotate3d(45, 0, 0, 180deg);
}
.circle-container:hover .outer-outer-ring {
transform: rotate3d(0, 45, 0, 180deg);
}
.circle-container, .front, .back {
width: 175px;
height: 175px;
background-color: rgba(0,0,0,0);
}
.circle, .outer-ring, .outer-outer-ring {
transition: 0.5s;
transform-style: preserve-3d;
transition-timing-function: cubic-bezier(0.785, 0.135, 0.150, 0.860);
}
.circle {
position: relative;
width: 175px;
height: 175px;
}
.front, .back {
border-radius: 50%;
box-shadow: 0px 0px 20px rgba(0,0,0,0.4);
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
}
.front {
background-color: #fff;
z-index: 2;
}
.front p {
margin-top: 1.2em;
font-family: cabin, sans-serif;
font-weight: 700;
font-size: 3em;
text-align: center;
color: #c02227;
}
.back {
transform: rotate3d(45,45,0,180deg);
background-color: #fff;
}
.back-logo {
width: 60%;
display: block;
margin: 2em auto;
}
.outer-ring {
position: absolute;
top: -10px;
left: -10px;
border-radius: 50%;
border: 2px solid #fff;
width: 191px;
height: 191px;
background-color: rgba(255,255,255,0);
box-shadow: 0px 0px 20px rgba(0,0,0,0.4);
}
.outer-outer-ring {
position: absolute;
top: -20px;
left: -20px;
border-radius: 50%;
border: 2px solid #fff;
width: 211px;
height: 211px;
background-color: rgba(255,255,255,0);
box-shadow: 0px 0px 20px rgba(0,0,0,0.4);
}