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>
Related
Problem
I'm creating a dropdown menu based on this codepen for my website and I'm trying to isolate the dropdown menu for just a button, within the same div. The code is working for a single button, but when ther's two or more, they all share the same dropdown... Here's an example.
▲ This is the button with the dropdown, it works
▲ But the second button, within the same DIV, also gets the same dropdown...
I believe it's something related to position:absolute, because it's somewhat better when I remove it (but the dropdown position also go to the div).
What I've tried
I was expecting this dropdown menu to be only for an ID, e.g. translate. But when I add the dropdown, it works for all buttons inside the same container div, which I do not want.
This is the code which I have tried:
/* Page settings */
.page-settings {
#include flex-center;
position: fixed;
flex-direction: row;
z-index: 10;
top: 3vw;
right: 2vw;
.btn {
#include flex-center;
#include ease-in-out;
width: min(10vw, 80px);
aspect-ratio: 1 / 1;
border-radius: 50%;
margin: 0 4%;
background-color: var(--color-grey-4);
border: none;
box-shadow: var(--box-shadow-1);
i {
font-size: var(--size-button);
color: var(--color-grey-1);
pointer-events: none;
}
&:hover {
transform: translateY(-3px);
box-shadow: 0 10px 20px var(--color-white);
}
}
}
#translate {
&:focus,
&:active {
.dropdown {
transform: translate(0, 20px);
opacity: 1;
visibility: visible;
}
}
.material-icons {
border-radius: 100%;
animation: ripple 0.6s linear infinite;
}
.dropdown {
position: absolute;
top: 100%;
left: 0;
background: #fff;
width: 100%;
border-radius: 4px;
box-shadow: 0 4px 12px rgba(#000, .1);
text-align: left;
opacity: 0;
visibility: hidden;
&:before {
content: '';
position: absolute;
top: -6px;
left: 20px;
width: 0;
height: 0;
box-shadow: 2px -2px 6px rgba(#000, .05);
border-top: 6px solid #fff;
border-right: 6px solid #fff;
border-bottom: 6px solid transparent;
border-left: 6px solid transparent;
transform: rotate(-45deg);
mix-blend-mode: multiple;
}
li {
z-index: 1;
position: relative;
background: #fff;
padding: 0 20px;
color: #666;
&:first-child {
border-radius: 4px 4px 0 0;
}
&:last-child {
border-radius: 0 0 4px 4px;
a {
border-bottom: 0;
}
}
}
a {
display: block;
border-bottom: 1px solid rgba(#000, .05);
padding: 16px 0;
color: inherit;
font-size: 10px;
text-decoration: none;
}
}
}
#media screen and (max-width: 600px) {
.page-settings {
flex-direction: column;
.btn {
margin: 7% 2%;
}
}
}
The minimal working code is below:
body {
background: #f5f5f5;
height: 100%;
color: rgba(0, 0, 0, 0.87);
font-family: "Roboto", sans-serif;
font-size: 14px;
font-weight: 400;
line-height: 1.5em;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.container {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.btn {
outline: 0;
display: inline-flex;
align-items: center;
justify-content: space-between;
background: #5380f7;
min-width: 260px;
border: 0;
border-radius: 4px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
box-sizing: border-box;
padding: 16px 20px;
color: #fff;
font-size: 12px;
font-weight: 600;
letter-spacing: 1.2px;
text-transform: uppercase;
overflow: hidden;
cursor: pointer;
}
.btn:focus .dropdown,
.btn:active .dropdown {
transform: translate(0, 20px);
opacity: 1;
visibility: visible;
}
.btn .material-icons {
border-radius: 100%;
-webkit-animation: ripple 0.6s linear infinite;
animation: ripple 0.6s linear infinite;
}
.btn .dropdown {
position: absolute;
top: 100%;
left: 0;
background: #fff;
width: 100%;
border-radius: 4px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
text-align: left;
opacity: 0;
visibility: hidden;
transition: 0.3s ease;
}
.btn .dropdown:before {
content: "";
position: absolute;
top: -6px;
left: 20px;
width: 0;
height: 0;
box-shadow: 2px -2px 6px rgba(0, 0, 0, 0.05);
border-top: 6px solid #fff;
border-right: 6px solid #fff;
border-bottom: 6px solid rgba(0, 0, 0, 0);
border-left: 6px solid rgba(0, 0, 0, 0);
transform: rotate(-45deg);
mix-blend-mode: multiple;
}
.btn .dropdown li {
z-index: 1;
position: relative;
background: #fff;
padding: 0 20px;
color: #666;
}
.btn .dropdown li.active {
color: #5380f7;
}
.btn .dropdown li:first-child {
border-radius: 4px 4px 0 0;
}
.btn .dropdown li:last-child {
border-radius: 0 0 4px 4px;
}
.btn .dropdown li:last-child a {
border-bottom: 0;
}
.btn .dropdown a {
display: block;
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
padding: 16px 0;
color: inherit;
font-size: 10px;
text-decoration: none;
}
#-webkit-keyframes ripple {
0% {
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.1),
0 0 0 20px rgba(255, 255, 255, 0.1), 0 0 0 40px rgba(255, 255, 255, 0.1),
0 0 0 60px rgba(255, 255, 255, 0.1);
}
100% {
box-shadow: 0 0 0 20px rgba(255, 255, 255, 0.1),
0 0 0 40px rgba(255, 255, 255, 0.1), 0 0 0 60px rgba(255, 255, 255, 0.1),
0 0 0 80px rgba(255, 255, 255, 0);
}
}
#keyframes ripple {
0% {
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.1),
0 0 0 20px rgba(255, 255, 255, 0.1), 0 0 0 40px rgba(255, 255, 255, 0.1),
0 0 0 60px rgba(255, 255, 255, 0.1);
}
100% {
box-shadow: 0 0 0 20px rgba(255, 255, 255, 0.1),
0 0 0 40px rgba(255, 255, 255, 0.1), 0 0 0 60px rgba(255, 255, 255, 0.1),
0 0 0 80px rgba(255, 255, 255, 0);
}
}
<div class="container">
<!-- Btn-->
<button class="btn">
<span>Account Settings</span><i class="material-icons">public</i>
<ul class="dropdown">
<li class="active">Profile Information</li>
<li>Change Password</li>
<li>
Become <b>PRO</b>
</li>
<li>Help</li>
<li>Log Out</li>
</ul>
</button>
<button class="btn">
<span>Account Settings</span><i class="material-icons">public</i>
<ul class="dropdown">
<li class="active">Profile Information</li>
<li>Change Password</li>
<li>
Become <b>PRO</b>
</li>
<li>Help</li>
<li>Log Out</li>
</ul>
</button>
</div>
My Research
I tried to create a new class called .dropdown-menu too, to no avail. Tried changing the position absolute and top+Left positioning to a mix between grid and grid-area, but I couldn't get it to work too.
I've googled it, searched websites and the answers are various, but didn't fit the scope of my problem.
Question
How could I isolate this dropdown-menu with two buttons under the same container?
Thanks!
It just needed a new :has() element on buttons, button:has(.dropdown). The fix was:
button:has(.dropdown) {
&:focus,
&:active {
.dropdown {
transform: translate(0, 20px);
opacity: 1;
visibility: visible;
}
}
}
Don't know why the id selector didn't work, but this way, it's working just fine.
I am creating a dropdown box for the account at the top right corner of the window.
I have added the code for the :before but does not seem to show above the element. The :before element is meant to be a triangle at the top of the ul container which points to where the dropdown has come from.
.DropDownContainer{
color: rgba(0, 0, 0, 0.87);
background-color: rgb(255, 255, 255);
transition: transform 250ms cubic-bezier(0.23, 1, 0.32, 1) 0ms, opacity 250ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
box-sizing: border-box;
font-family: Roboto, sans-serif;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
box-shadow: rgba(0, 0, 0, 0.12) 0px 1px 6px, rgba(0, 0, 0, 0.12) 0px 1px 4px;
border-radius: 2px;
position: fixed;
z-index: 2100;
opacity: 1;
transform: scale(1, 1);
transform-origin: left top;
max-height: 670px;
overflow-y: auto;
float: left;
text-align: left;
top: 55px;
right: 20px;
padding: 26px 0;
border-radius: 8px;
position: absolute;
top: calc(60px - 10px);
width: 210px;
list-style: none;
background-clip: padding-box;
padding-left:0;
}
.DropDownContainer:before{
content: '';
width: 0;
height: 0;
position: absolute;
top: -20px;
right: 120px;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
}
.DropDownButton{
display: flex;
justify-content: left;
padding: 10px;
padding-left: 28px;
padding-right: 28px;
letter-spacing: 1px;
color: rgb(38, 38, 38);
}
.DropDownButton a{
text-decoration: none;
}
.DropDownButton img{
height: 20px;
width: 20px;
margin-right: 10px;
}
.DropDownButton:hover{
background-color: rgba(36, 36, 36, 0.071);
cursor: pointer;
}
(<ul className={classes.DropDownContainer}>
<li className={classes.DropDownButton} onClick={() => setShowDropDown(false)}>Profile</li>
<li className={classes.DropDownButton}>Edit Profile</li>
<li className={classes.DropDownButton}>My Hub</li>
<li className={classes.DropDownButton} >My Favourites</li>
<li className={classes.DropDownButton} >My Must Reads</li>
<li className={classes.DropDownButton}>Account Settings</li>
<li className={classes.DropDownButton} >Sign Out</li>
</ul>)
It is meant to be a triangle at the top of the ul container.
You should write two colons not only a colon for ' before '. I mean your code should be as such :
.DropDownContainer::before {
content: '';
width: 0;
height: 0;
position: absolute;
top: -20px;
right: 120px;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
}
I spent a bit of time creating a new navigation menu for a project. I used float elements in my CSS file which seems to play an important factor in keeping my navigation menu keep its appearance. But currently the alignment of the navigation menu is off and my goal is to have it centered in the view.
header {
background: #3d4144 url("../img/bg.png") 0 0 repeat;
border-bottom: 5px solid #ddd;
height: 170px;
padding-top: 15px;
}
#title {
color: white;
display: block;
letter-spacing: 2px;
margin-left: 50px;
padding: 20px;
position: relative;
text-align: left;
}
#headerMessage {
color: white;
display: block;
letter-spacing: 2px;
padding: 20px;
position: relative;
text-align: center;
}
.container {
margin: 0 auto;
width: 540px;
}
#navHeader {
-webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
background: #464b4c;
background-image: -webkit-linear-gradient(top, #464b4c, #3f4344);
background-image: -moz-linear-gradient(top, #464b4c, #3f4344);
background-image: -o-linear-gradient(top, #464b4c, #3f4344);
background-image: linear-gradient(to bottom, #464b4c, #3f4344);
border-top: 1px solid #353939;
border-bottom: 1px solid #2e3131;
box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
height: 36px;
}
#navHeader a {
-webkit-transition: 0.1s ease-out;
-moz-transition: 0.1s ease-out;
-o-transition: 0.1s ease-out;
transition: 0.1s ease-out;
-webkit-transition-property: background-color, line-height;
-moz-transition-property: background-color, line-height;
-o-transition-property: background-color, line-height;
transition-property: background-color, line-height;
text-align: center;
}
#navHeader #navHeaderUL {
float: left;
border-left: 1px solid #353939;
border-left: 1px solid rgba(0, 0, 0, 0.2);
border-right: 1px solid #4d5354;
border-right: 1px solid rgba(255, 255, 255, 0.06);
}
#navHeader li {
float: left;
}
#navHeader a {
display: block;
padding: 0 20px;
line-height: 36px;
color: #ddd;
text-decoration: none;
text-shadow: 0 -1px #2e3131;
border-left: 1px solid #4d5354;
border-left: 1px solid rgba(255, 255, 255, 0.06);
border-right: 1px solid #353939;
border-right: 1px solid rgba(0, 0, 0, 0.2);
cursor: pointer;
}
#navHeader a:hover {
background: #4d5354;
background: rgba(255, 255, 255, 0.05);
}
#navHeader li.active a,
#navHeader li.active a:hover,
#navHeader a:active {
padding: 0 21px;
line-height: 33px;
color: #eee;
background: #323637;
border-left: 0;
border-right: 0;
border-bottom: 3px solid #48a9c0;
background-image: -webkit-linear-gradient(top, #484e4f, #323637);
background-image: -moz-linear-gradient(top, #484e4f, #323637);
background-image: -o-linear-gradient(top, #484e4f, #323637);
background-image: linear-gradient(to bottom, #484e4f, #323637);
-webkit-box-shadow: inset 0 -1px #151717, inset 0 -1px 8px rgba(0, 0, 0, 0.2);
box-shadow: inset 0 -1px #151717, inset 0 -1px 8px rgba(0, 0, 0, 0.2);
}
#navHeader li.green a,
#navHeader li.green a:active {
border-bottom-color: #56c93d;
}
#navHeader li.red a,
#navHeader li.red a:active {
border-bottom-color: #a54e49;
}
#navHeader li.purple a,
#navHeader li.purple a:active {
border-bottom-color: #c052b9;
}
#navHeader li.yellow a,
#navHeader li.yellow a:active {
border-bottom-color: #c0bb30;
}
<header>
<h1 id="title">Insert Title</h1>
<h2 id="headerMessage">INSERT MESSAGE!</h2>
<nav id="navHeader">
<div class="container">
<ul id="navHeaderUL">
<li class="active">Home
<li class="green">Schedule
<li class="red">Track
<li class="yellow">Contact
</ul>
</div>
<!-- end of container -->
</nav>
<!-- end of navHeader -->
</header>
You can remove line-height on #navHeader a which is causing the off vertical alignment (or is this intended?).
Remove float and set display: inline-block so you can horizontally center the ul with text-align: center.
Please find CSS tweaks commented below.
header {
background: #3d4144 url("../img/bg.png") 0 0 repeat;
border-bottom: 5px solid #ddd;
height: 170px;
padding-top: 15px;
}
#title {
color: white;
display: block;
letter-spacing: 2px;
margin-left: 50px;
padding: 20px;
position: relative;
text-align: left;
}
#headerMessage {
color: white;
display: block;
letter-spacing: 2px;
padding: 20px;
position: relative;
text-align: center;
}
.container {
margin: 0 auto;
width: 540px;
}
#navHeader {
-webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
background: #464b4c;
background-image: -webkit-linear-gradient(top, #464b4c, #3f4344);
background-image: -moz-linear-gradient(top, #464b4c, #3f4344);
background-image: -o-linear-gradient(top, #464b4c, #3f4344);
background-image: linear-gradient(to bottom, #464b4c, #3f4344);
border-top: 1px solid #353939;
border-bottom: 1px solid #2e3131;
box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
height: 36px;
}
#navHeader a {
-webkit-transition: 0.1s ease-out;
-moz-transition: 0.1s ease-out;
-o-transition: 0.1s ease-out;
transition: 0.1s ease-out;
-webkit-transition-property: background-color, line-height;
-moz-transition-property: background-color, line-height;
-o-transition-property: background-color, line-height;
transition-property: background-color, line-height;
text-align: center;
}
#navHeader #navHeaderUL {
/* new */
text-align: center;
/*float: left;*/
border-left: 1px solid #353939;
border-left: 1px solid rgba(0, 0, 0, 0.2);
border-right: 1px solid #4d5354;
border-right: 1px solid rgba(255, 255, 255, 0.06);
}
#navHeader li {
/* new*/
float: none;
display: inline-block;
}
#navHeader a {
display: block;
padding: 0 20px;
/*new*/
/*margin-top: -6px;*/
/*line-height: 36px;*/
color: #ddd;
text-decoration: none;
text-shadow: 0 -1px #2e3131;
border-left: 1px solid #4d5354;
border-left: 1px solid rgba(255, 255, 255, 0.06);
border-right: 1px solid #353939;
border-right: 1px solid rgba(0, 0, 0, 0.2);
cursor: pointer;
}
#navHeader a:hover {
background: #4d5354;
background: rgba(255, 255, 255, 0.05);
}
#navHeader li.active a,
#navHeader li.active a:hover,
#navHeader a:active {
padding: 0 21px;
/*new*/
margin-top: -6px;
/*line-height: 33px;*/
color: #eee;
background: #323637;
border-left: 0;
border-right: 0;
border-bottom: 3px solid #48a9c0;
background-image: -webkit-linear-gradient(top, #484e4f, #323637);
background-image: -moz-linear-gradient(top, #484e4f, #323637);
background-image: -o-linear-gradient(top, #484e4f, #323637);
background-image: linear-gradient(to bottom, #484e4f, #323637);
-webkit-box-shadow: inset 0 -1px #151717, inset 0 -1px 8px rgba(0, 0, 0, 0.2);
box-shadow: inset 0 -1px #151717, inset 0 -1px 8px rgba(0, 0, 0, 0.2);
}
#navHeader li.green a,
#navHeader li.green a:active {
border-bottom-color: #56c93d;
}
#navHeader li.red a,
#navHeader li.red a:active {
border-bottom-color: #a54e49;
}
#navHeader li.purple a,
#navHeader li.purple a:active {
border-bottom-color: #c052b9;
}
#navHeader li.yellow a,
#navHeader li.yellow a:active {
border-bottom-color: #c0bb30;
}
<header>
<h1 id="title">Insert Title</h1>
<h2 id="headerMessage">INSERT MESSAGE!</h2>
<nav id="navHeader">
<div class="container">
<ul id="navHeaderUL">
<li class="active">Home
<li class="green">Schedule
<li class="red">Track
<li class="yellow">Contact
</ul>
</div>
<!-- end of container -->
</nav>
<!-- end of navHeader -->
</header>
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);
}
I have the 2 divs that I want styled the same. One is called #popover, the other is called #recordViewPopover. Here is my CSS for popover. How can I make #recordViewPopover use the same CSS as #popover?
#popover {
-webkit-border-radius: 4px;
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
-webkit-transition: opacity 0.25s linear;
-moz-border-radius: 4px;
-moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
-moz-transition: opacity 0.25s linear;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
transition: opacity 0.25s linear;
border: 3px solid black;
border-radius: 4px;
background-color: white;
color: black;
cursor: auto;
display: none;
font-weight: normal;
line-height: 1;
position: absolute;
right: 22px;
z-index: 5000000;
}
#popover > .popover_triangle
{
border-top: 16px solid rgba(0,0,0,0);
border-left: 16px solid rgba(0,0,0,0);
border-right: 16px solid rgba(0,0,0,0);
border-bottom: 16px solid black;
font-size: 0px;
line-height: 0%;
position: absolute;
top: -34px;
left:150px;
width: 0px;
}
#popover > .header
{
background: #222;
background: -moz-linear-gradient(top, #333 0%, #111 100%);
background-image: -webkit-gradient(
linear,
left top,
left bottom,
from(rgba(255, 255, 255, 0.55)),
color-stop(0.2, rgba(255, 255, 255, 0.35)),
color-stop(0.5, rgba(255, 255, 255, 0.1)),
color-stop(0.5, transparent),
to(transparent));
color: white;
font-weight: bold;
height: 27px;
line-height: 25px;
margin: 0;
padding: 3px;
text-shadow: rgba(0, 0, 0, 1) 0 -1px 0;
text-align: center;
}
#popover > .content
{
font-size: 12px;
max-height: 400px;
overflow-x: hidden;
overflow-y: auto;
width: 190px;
}
#popover > .content ul
{
list-style: none;
margin: 0;
padding: 0;
}
#popover > .content ul li
{
border-bottom: #ccc 1px solid;
line-height: 25px;
}
#popover > .content ul li.item:hover
{
border-bottom: #1443be 1px solid;
}
#popover > .content ul li h6
{
background: #f3f3f3;
display: block;
color: #000;
font-size: 13px;
padding: 0 10px;
text-shadow: rgba(255, 255, 255, 1) 0 -1px 0;
}
#popover > .content ul li a
{
display: block;
padding: 0 14px;
}
#popover > .content ul li a:link,
#popover > .content ul li a:visited
{
text-decoration:none;color:#333;
}
#popover > .content ul li a:focus,
#popover > .content ul li a:hover
{
background: #5396e3 url('../images/arrow-small.png') 97% center no-repeat;
color: #fff;
text-decoration: none;
text-shadow: rgba(0, 0, 0, .55) 0 -1px 0;
}
Here are my divs
<div id='popover'>
<div class='popover_triangle'></div>
<div class='header'>OPTIONS</div>
<div class='content'>
<ul>
<li><h6>OBJECT VIEW</h6></li>
<li class='item'><a onclick=\"$(document).trigger('objectViewFiltersEnabled', [ !filtersEnabled ]);\">Filters</a></li>
<li class='item'><a href=\"#\" >Configuration</a></li>
<li><h6>OBJECT</h6></li>
<li class='item'><a href=\"#\" >Configuration</a></li>
<li class='item'><a href=\"#\" >Documentation</a></li>
</ul>
</div>
</div>
<div id='recordViewPopover'>
<div class='popover_triangle'></div>
<div class='header'>OPTIONS</div>
<div class='content'>
<ul>
<li><h6>Information</h6></li>
<li class='item'><a href='#' >Change Logs</a></li>
<li><h6>Actions</h6></li>
<li class='item'><a href='#' >Assign</a></li>
<li class='item'><a href='#' >Share</a></li>
<li class='item'><a href='#' >Convert</a></li>
<li class='item'><a href='#' >Copy</a></li>
<li class='item'><a href='#' >Clone</a></li>
<li class='item'><a href='#' >Merge</a></li>
<li class='item'><a href='#' >Refresh</a></li>
<li class='item'><a href='#' >Delete</a></li>
</ul>
</div>
</div>
You would assign them both the same class. To do this you would have:
<div id='popover' class='someName'>
<div id='recordViewPopover' class='someName'>
and your CSS would be declared:
.someName {
//Add styles here
}
You could group multiple selectors:
#popover > .popover_triangle,
#recordViewPopover > .popover_triangle {
Or give the elements a class, and use a class selector where you have the id selector.
.popover > .popover_triangle {
#popover, #recordViewPopover {
...
}
Oh, and also
#popover > .popover_triangle,
#recordViewPopover > .popover_triangle {
...
}
But if you expect to have more divs like these two, it would indeed be better to define a class for them.