Tooltip using title attribute without js? - html

I'm searching a long time after another solution for making tooltip from title="" attribute on :hover selection.
I hope to find a way for using title="" attribute and change my content:"" property dynamically.
* {
-webkit-font-smoothing: antialiased;
font-family: "Trebuchet MS", Helvetica, sans-serif;
}
div {
width: 300px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
}
button {
cursor: pointer;
position: relative;
display: inline-block;
background: rgb(25, 181, 206);
color: #fff;
padding: 5px 15px;
border: none;
font-size: 1em;
}
button::after {
content: "I'm a css tooltip!"; /* <= dynamically title content */
z-index: -999;
position: absolute;
top: 110%;
left: 0;
width: 90%;
padding: 5px 5%;
font-size: 70%;
text-align: center;
color: #fff;
background: rgb(21, 151, 171);
opacity: 0;
-webkit-transform: rotateX(180deg) rotateY(20deg) rotateZ(20deg);
-moz-transform: rotateX(180deg) rotateY(0deg) rotateZ(0deg);
-o-transform: rotateX(180deg) rotateY(0deg) rotateZ(0deg);
-ms-transform: rotateX(180deg) rotateY(0deg) rotateZ(0deg);
transform: rotateX(180deg) rotateY(0deg) rotateZ(0deg);
-webkit-transform-origin: 100% 0%;
transform-origin: 100% 0%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
transition: cubic-bezier(0.3, 0.05, 0.4, 1.7) .55s;
-webkit-transition: cubic-bezier(0.3, 0.05, 0.4, 1.7) .55s;
-moz-transition: cubic-bezier(0.3, 0.05, 0.4, 1.7) .55s;
-ms-transition: cubic-bezier(0.3, 0.05, 0.4, 1.7) .55s;
-o-transition: cubic-bezier(0.3, 0.05, 0.4, 1.7) .55s;
}
button:hover::after {
opacity: 1;
box-shadow: 0px 2px 3px 0px rgba(0,0,0,0.15);
-webkit-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
-moz-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
-o-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
-ms-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
}
<div>
<button title="I'm a css tooltip1!">button</button>
<button title="I'm a css tooltip2!">button</button>
<button title="I'm a css tooltip3!">button</button>
</div>
Demo
There is a way to do that?

Use data- attribute if you need custom attributes, and without data- if you need non custom attributes (eg title)
* {
-webkit-font-smoothing: antialiased;
font-family: "Trebuchet MS", Helvetica, sans-serif;
}
div {
width: 300px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
}
button {
cursor: pointer;
position: relative;
display: inline-block;
background: rgb(25, 181, 206);
color: #fff;
padding: 5px 15px;
border: none;
font-size: 1em;
}
button::after {
content: attr(data-title); /* <= dynamically title content */
z-index: -999;
position: absolute;
top: 110%;
left: 0;
width: 90%;
padding: 5px 5%;
font-size: 70%;
text-align: center;
color: #fff;
background: rgb(21, 151, 171);
opacity: 0;
-webkit-transform: rotateX(180deg) rotateY(20deg) rotateZ(20deg);
-moz-transform: rotateX(180deg) rotateY(0deg) rotateZ(0deg);
-o-transform: rotateX(180deg) rotateY(0deg) rotateZ(0deg);
-ms-transform: rotateX(180deg) rotateY(0deg) rotateZ(0deg);
transform: rotateX(180deg) rotateY(0deg) rotateZ(0deg);
-webkit-transform-origin: 100% 0%;
transform-origin: 100% 0%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
transition: cubic-bezier(0.3, 0.05, 0.4, 1.7) .55s;
-webkit-transition: cubic-bezier(0.3, 0.05, 0.4, 1.7) .55s;
-moz-transition: cubic-bezier(0.3, 0.05, 0.4, 1.7) .55s;
-ms-transition: cubic-bezier(0.3, 0.05, 0.4, 1.7) .55s;
-o-transition: cubic-bezier(0.3, 0.05, 0.4, 1.7) .55s;
}
button:hover::after {
opacity: 1;
box-shadow: 0px 2px 3px 0px rgba(0,0,0,0.15);
-webkit-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
-moz-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
-o-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
-ms-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
}
<div>
<button data-title="I'm a css tooltip1!">button</button>
<button data-title="I'm a css tooltip2!">button</button>
<button data-title="I'm a css tooltip3!">button</button>
</div>
Jsfiddle link

I think there is a nice example of tooltips: bootstrap
example:
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="left" title="Tooltip on left">Tooltip on left</button>

Related

Flipbox is displaying warped skewed image on hover in Chrome

Someone coded a flip box with CSS transform. It works fine in Safari and Firefox, but not in Chrome. In Chrome it continues to display the image and skews it. I tried several things in the CSS (labeled "Extra Code START") but it's not working. How do I just make the image disappear or fix this?
I made a codepen:
https://codepen.io/harmjoy/pen/ExwVarv
.collection-type-index #call-to-actions {
background:rgba(2,139,255,1)
}
.collection-type-index #our-programs-1 {
background:#f0f0f0
}
.flip {
margin: 30px auto;
position: relative;
width: 300px;
height: 200px;
color: #000;
text-align:center;
}
.flip h1 {
font-size: 30px;
font-weight: bold;
line-height:98px;
margin:0;
padding:0;
}
.flip h2 {
font-size: 21px;
font-weight: bold;
margin: 0;
padding: 0 0 12px;
}
.flip p {
font-size: 14px;
padding: 5px 0px;
margin: 0 0 8px 0;
}
.default-state, .active-state {
height: 200px;
position: absolute;
left: 0;
top: 0;
transition: transform 0.4s ease;
transform-origin: center center -50px;
-webkit-transform-origin: center center -50px;
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
}
.default-state {
transform: perspective(1000px) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
-webkit-transform: perspective(1000px) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
-moz-transform: perspective(1000px) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
-o-transform: perspective(1000px) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
-ms-transform: perspective(1000px) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
height: 100%;
display: flex;
}
.default-state img {
position: relative;
flex-shrink: 0;
}
.default-state h2 {
position: absolute;
z-index: 2;
color: #fff;
text-transform: uppercase;
width: 100%;
align-self: center;
text-shadow: 0px 1px 10px rgba(0, 0, 0, 1);
}
.active-state {
transform: perspective(1000px) rotateX(-90deg) rotateY(0deg) rotateZ(0deg);
-webkit-transform: perspective(1000px) rotateX(-90deg) rotateY(0deg) rotateZ(0deg);
-moz-transform: perspective(1000px) rotateX(-90deg) rotateY(0deg) rotateZ(0deg);
-o-transform: perspective(1000px) rotateX(-90deg) rotateY(0deg) rotateZ(0deg);
-ms-transform: perspective(1000px) rotateX(-90deg) rotateY(0deg) rotateZ(0deg);
}
.flip:hover .default-state {
height:200px;
width:300px;
transform: perspective(0px) rotateX(90deg) rotateY(0) rotateZ(0deg);
-webkit-transform: perspective(0px) rotateX(90deg) rotateY(0) rotateZ(0deg);
-moz-transform: perspective(0px) rotateX(90deg) rotateY(0) rotateZ(0deg);
-o-transform: perspective(0px) rotateX(90deg) rotateY(0) rotateZ(0deg);
-ms-transform: perspective(0px) rotateX(90deg) rotateY(0) rotateZ(0deg);
}
.flip:hover .active-state {
height:200px;
width:300px;
z-index: 99999;
transform: perspective(1000px) rotateX(0deg) rotateY(0deg) rotateZ(0);
-webkit-transform: perspective(1000px) rotateX(0deg) rotateY(0deg) rotateZ(0);
-moz-transform: perspective(1000px) rotateX(0deg) rotateY(0deg) rotateZ(0);
-o-transform: perspective(1000px) rotateX(0deg) rotateY(0deg) rotateZ(0);
-ms-transform: perspective(1000px) rotateX(0deg) rotateY(0deg) rotateZ(0);
}
/* Extra Code START */
.flip:hover .active-state,
.flip:hover .default-state {
transform-origin: none;
-webkit-transform-origin: none !important;
}
.flip:hover .active-state img,
.flip:hover .default-state img {
display: none !important;
}
/* Extra Code END */
a.btn {
background: #013b59;
color: #ffffff;
font-size: 14px;
padding: 8px 20px 8px 20px;
text-decoration: none;
}
a.btn:hover {
background: #33627a;
text-decoration: none;
}
.blog-item-wrapper .post-title { display: none; }
<div class="flip" id="yui_3_17_2_1_1638546693755_910">
<div class="active-state" id="yui_3_17_2_1_1638546693755_909">
<h2>Hope After School</h2>
<a class="btn" href="/hope-after-school" id="yui_3_17_2_1_1638546693755_908">Learn More</a>
</div>
<div class="default-state">
<h2>After-School Programs</h2>
<img src="https://static1.squarespace.com/static/5b0ff9af3e2d099669c3dc55/5b1001a688251b1ccbfd906e/5b1004112b6a28f09dc1af7d/1527776479763/child-865116_1920.jpg?format=750w" alt="Childcare">
</div>
</div>
In my chrome browser there indeed was some strange artefact of the image visible although not recognisable as the image anymore. I fixed it with * { backface-visibility: hidden; } out of laziness, which worked fine but you would probably want to apply this only to the elements being transformed. backface-visibilty precisely handles the see-throughness os 3D elements which is what you are dealing with here.

Transform Rotate Menu Item Circular Menu

I have modified a circular menu that I found on this pen
But I am having trouble rotating the menu items around the main circle. By default of this pen, the button's bottom part is perpendicular to it's relative position, but since I changed them with font icons, they look upside down or crooked.
I'm a CSS noob, so I need some help please, been at this for hours!
I've tried a couple of things like:
menu li::after{
transform: rotate(0deg);
-webkit-transform: rotate(0deg);
}
or something like
menu li li:nth-of-type(1) {
-webkit-transform: rotate(180deg) translate(0, 0);
transform: rotate(180deg) translate(0, 0);
}
None of them seems to be working. Currently my component looks like this:
Here is my full CSS and HTML...
menu {
transition: all 0.25s ease-in-out;
transition-delay: 0.75s;
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
background-color: #2e7bbd;
margin: -45px 0 0 -45px;
position: fixed;
width: 90px;
height: 90px;
border-radius: 50%;
cursor: pointer;
right: 2%;
bottom: 2%;
z-index: 99999;
}
menu:before, menu:after {
content: "";
z-index: 2;
position: fixed;
width: 3px;
height: 22.5px;
cursor: pointer;
background-color: #fbfdff;
top: 50%;
left: 50%;
}
menu:before {
-webkit-transform: translate(-50%, -50%) rotate(-90deg);
transform: translate(-50%, -50%) rotate(-90deg);
}
menu:after {
-webkit-transform: translate(-50%, -50%) rotate(0deg);
transform: translate(-50%, -50%) rotate(0deg);
}
menu li {
transition: all 0.25s ease-in-out;
transition-delay: 0.75s;
width: 59.4px;
height: 59.4px;
margin: -29.7px 0 0 -29.7px;
opacity: 0;
text-align: center;
font-size: 18px;
font-family: Helvetica, sans-serif;
font-weight: 100;
line-height: 59.4px;
color: #fbfdff;
border-radius: 50%;
background-color: #428dce;
list-style-type: none;
position: fixed;
z-index: 100;
left: 50%;
top: 50%;
}
menu li::after{
transform: rotate(0deg);
-webkit-transform: rotate(0deg);
}
menu li li:nth-of-type(1) {
-webkit-transform: rotate(180deg) translate(0, 0);
transform: rotate(180deg) translate(0, 0);
animation-name: crazy;
animation-duration: 2s;
animation-delay: 1s;
animation-iteration-count: infinite;
}
menu li li:nth-of-type(2) {
-webkit-transform: rotate(0deg) translate(0, 0);
transform: rotate(0deg) translate(0, 0);
}
menu li li:nth-of-type(3) {
-webkit-transform: rotate(0deg) translate(0, 0);
transform: rotate(0deg) translate(0, 0);
}
menu:hover {
-webkit-transform: rotate(-180deg);
transform: rotate(-180deg);
transition-delay: 0s;
}
menu:hover li {
transition-delay: 0.1s;
opacity: 1;
}
menu:hover li:nth-of-type(1) {
-webkit-transform: rotate(359deg) translate(0, 90px);
transform: rotate(359deg) translate(0, 90px);
}
menu:hover li:nth-of-type(2) {
-webkit-transform: rotate(310deg) translate(0, 90px);
transform: rotate(310deg) translate(0, 90px);
}
menu:hover li:nth-of-type(3) {
-webkit-transform: rotate(260deg) translate(0, 90px);
transform: rotate(260deg) translate(0, 90px);
}
<!--<menu>
<li><i className="fas fa-bell"></i></li>
<li><i className="fas fa-cog"></i></li>
<li><i className="fas fa-terminal"></i></li>
</menu>-->
<menu>
<li>1</li>
<li>2</li>
<li>3</li>
</menu>
EDIT: I don't know why the button looks like an ellipse in the code snippet, but let's ignore this for this argument's sake. It looks fine on my app :)
This has fixed your rotation problem. please check my code.
I have added after each li and set rotation in after, here is the code what I added.
menu li i{
content: "1";
display: flex !important;
align-items: center;
justify-content: center;
transform-origin: center;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
border-radius: 100%;
}
menu li:nth-of-type(1) i {
transform: rotate(180deg);
}
menu li:nth-of-type(2) i {
transform: rotate(230deg);
}
menu li:nth-of-type(3) i {
transform: rotate(280deg);
}
And this is your full code.
menu {
transition: all 0.25s ease-in-out;
transition-delay: 0.75s;
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
background-color: #2e7bbd;
margin: -45px 0 0 -45px;
position: fixed;
width: 90px;
height: 90px;
border-radius: 50%;
cursor: pointer;
right: 2%;
bottom: 2%;
z-index: 99999;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
menu:before, menu:after {
content: "";
z-index: 2;
position: fixed;
width: 3px;
height: 22.5px;
cursor: pointer;
background-color: #fbfdff;
top: 50%;
left: 50%;
}
menu:before {
-webkit-transform: translate(-50%, -50%) rotate(-90deg);
transform: translate(-50%, -50%) rotate(-90deg);
}
menu:after {
-webkit-transform: translate(-50%, -50%) rotate(0deg);
transform: translate(-50%, -50%) rotate(0deg);
}
menu li {
transition: all 0.25s ease-in-out;
transition-delay: 0.75s;
width: 59.4px;
height: 59.4px;
margin: -29.7px 0 0 -29.7px;
opacity: 0;
text-align: center;
font-size: 18px;
font-family: Helvetica, sans-serif;
font-weight: 100;
line-height: 59.4px;
color: #fbfdff;
border-radius: 50%;
background-color: #428dce;
list-style-type: none;
position: fixed;
z-index: 100;
left: 50%;
top: 50%;
}
menu li li:nth-of-type(1) {
-webkit-transform: rotate(180deg) translate(0, 0);
transform: rotate(180deg) translate(0, 0);
animation-name: crazy;
animation-duration: 2s;
animation-delay: 1s;
animation-iteration-count: infinite;
}
menu li li:nth-of-type(2) {
-webkit-transform: rotate(0deg) translate(0, 0);
transform: rotate(0deg) translate(0, 0);
}
menu li li:nth-of-type(3) {
-webkit-transform: rotate(0deg) translate(0, 0);
transform: rotate(0deg) translate(0, 0);
}
menu:hover {
-webkit-transform: rotate(-180deg);
transform: rotate(-180deg);
transition-delay: 0s;
}
menu:hover li {
transition-delay: 0.1s;
opacity: 1;
}
menu:hover li:nth-of-type(1) {
-webkit-transform: rotate(359deg) translate(0, 90px);
transform: rotate(359deg) translate(0, 90px);
}
menu:hover li:nth-of-type(2) {
-webkit-transform: rotate(310deg) translate(0, 90px);
transform: rotate(310deg) translate(0, 90px);
}
menu:hover li:nth-of-type(3) {
-webkit-transform: rotate(260deg) translate(0, 90px);
transform: rotate(260deg) translate(0, 90px);
}
menu li i{
content: "1";
display: flex !important;
align-items: center;
justify-content: center;
transform-origin: center;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
border-radius: 100%;
}
menu li:nth-of-type(1) i {
transform: rotate(180deg);
}
menu li:nth-of-type(2) i {
transform: rotate(230deg);
}
menu li:nth-of-type(3) i {
transform: rotate(280deg);
}
And here is the HTML
<menu>
<li><i class="fas fa-bell"></i></li>
<li><i class="fas fa-cog"></i></li>
<li><i class="fas fa-terminal"></i></li>
</menu>
menu {
transition: all 0.25s ease-in-out;
transition-delay: 0.75s;
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
background-color: #2e7bbd;
margin: -45px 0 0 -45px;
position: fixed;
width: 30px;
height: 70px;
border-radius: 50%;
cursor: pointer;
right: 2%;
bottom: 2%;
z-index: 99999;
}
menu:before, menu:after {
content: "";
z-index: 2;
position: fixed;
width: 3px;
height: 22.5px;
cursor: pointer;
background-color: #fbfdff;
top: 50%;
left: 50%;
}
menu:before {
-webkit-transform: translate(-50%, -50%) rotate(-90deg);
transform: translate(-50%, -50%) rotate(-90deg);
}
menu:after {
-webkit-transform: translate(-50%, -50%) rotate(0deg);
transform: translate(-50%, -50%) rotate(0deg);
}
menu li {
transition: all 0.25s ease-in-out;
transition-delay: 0.75s;
width: 59.4px;
height: 59.4px;
margin: -29.7px 0 0 -29.7px;
opacity: 0;
text-align: center;
font-size: 18px;
font-family: Helvetica, sans-serif;
font-weight: 100;
line-height: 59.4px;
color: #fbfdff;
border-radius: 50%;
background-color: #428dce;
list-style-type: none;
position: fixed;
z-index: 100;
left: 50%;
top: 50%;
}
menu li::after{
transform: rotate(0deg);
-webkit-transform: rotate(0deg);
}
menu li li:nth-of-type(1) {
-webkit-transform: rotate(180deg) translate(0, 0);
transform: rotate(180deg) translate(0, 0);
animation-name: crazy;
animation-duration: 2s;
animation-delay: 1s;
animation-iteration-count: infinite;
}
menu li li:nth-of-type(2) {
-webkit-transform: rotate(0deg) translate(0, 0);
transform: rotate(0deg) translate(0, 0);
}
menu li li:nth-of-type(3) {
-webkit-transform: rotate(0deg) translate(0, 0);
transform: rotate(0deg) translate(0, 0);
}
menu:hover {
-webkit-transform: rotate(-180deg);
transform: rotate(-180deg);
transition-delay: 0s;
}
menu:hover li {
transition-delay: 0.1s;
opacity: 1;
}
menu:hover li:nth-of-type(1) {
-webkit-transform: rotate(359deg) translate(0, 90px);
transform: rotate(359deg) translate(0, 90px);
}
menu:hover li:nth-of-type(2) {
-webkit-transform: rotate(310deg) translate(0, 90px);
transform: rotate(310deg) translate(0, 90px);
}
menu:hover li:nth-of-type(3) {
-webkit-transform: rotate(260deg) translate(0, 90px);
transform: rotate(260deg) translate(0, 90px);
}
li a {
transform :rotate(180deg);
display:block;
}
<menu>
<li><a>1</a></li>
<li><a>2</a></li>
<li><a>3</a></li>
</menu>
wrap your list content in a block element or inline element like i did! and rotate this element 180deg!
This will fix your rotation problem.
li a {
transform :rotate(180deg);
}
Also if you need a proper circular design for + icon, you need to fix width and height for .menu class in CSS as follow:
width: 30px;
height: 70px;

ihover is not working with bootstrap

I am trying to work out ihover with bootstrap but its not working. I searched for this problem and tried the solution provided but still its not working. The answer is not satisfactory.This is the code that I am trying to implement. I took it from this link. I added css from this link. Please tell me what am I missing?
<div class="col-md-6">
<div class="ih-item square effect7">
<a href="#">
<div class="img"><img src="homepage-pics/electrician.jpg"></div>
<div class="info">
<h3>Electrician</h3>
<p>Need an electrician?click here</p>
</div>
</a>
</div>
</div>
The issue is with the anchor in your .info p tag. if you remove the anchor from this <p>, it works.
.ih-item {
position: relative;
-webkit-transition: all 0.35s ease-in-out;
-moz-transition: all 0.35s ease-in-out;
transition: all 0.35s ease-in-out
}
.ih-item,
.ih-item * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box
}
.ih-item a {
color: #333
}
.ih-item a:hover {
text-decoration: none
}
.ih-item img {
width: 100%;
height: 100%
}
.ih-item.circle {
position: relative;
width: 220px;
height: 220px;
border-radius: 50%
}
.ih-item.circle .img {
position: relative;
width: 220px;
height: 220px;
border-radius: 50%
}
.ih-item.circle .img:before {
position: absolute;
display: block;
content: '';
width: 100%;
height: 100%;
border-radius: 50%;
box-shadow: inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.3);
-webkit-transition: all 0.35s ease-in-out;
-moz-transition: all 0.35s ease-in-out;
transition: all 0.35s ease-in-out
}
.ih-item.circle .img img {
border-radius: 50%
}
.ih-item.circle .info {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
text-align: center;
border-radius: 50%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden
}
.ih-item.square {
position: relative;
width: 316px;
height: 216px;
border: 8px solid #fff;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3)
}
.ih-item.square .info {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
text-align: center;
-webkit-backface-visibility: hidden;
backface-visibility: hidden
}
.ih-item.circle.effect7 .img {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
-webkit-transition: all 0.35s ease-out;
-moz-transition: all 0.35s ease-out;
transition: all 0.35s ease-out
}
.ih-item.circle.effect7.colored .info {
background: #1a4a72
}
.ih-item.circle.effect7 .info {
background: #333;
opacity: 0;
visibility: hidden;
pointer-events: none;
-webkit-transition: all 0.35s ease 0.2s;
-moz-transition: all 0.35s ease 0.2s;
transition: all 0.35s ease 0.2s
}
.ih-item.circle.effect7 .info h3 {
color: #fff;
text-transform: uppercase;
position: relative;
letter-spacing: 2px;
font-size: 22px;
margin: 0 30px;
padding: 55px 0 0 0;
height: 110px;
text-shadow: 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.3)
}
.ih-item.circle.effect7 .info p {
color: #bbb;
padding: 10px 5px;
font-style: italic;
margin: 0 30px;
font-size: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.5)
}
.ih-item.circle.effect7 a:hover .img {
opacity: 0;
-webkit-transform: scale(0.5);
-moz-transform: scale(0.5);
-ms-transform: scale(0.5);
-o-transform: scale(0.5);
transform: scale(0.5)
}
.ih-item.circle.effect7 a:hover .info {
visibility: visible;
opacity: 1
}
.ih-item.circle.effect7.left_to_right .info {
-webkit-transform: translateX(-100%);
-moz-transform: translateX(-100%);
-ms-transform: translateX(-100%);
-o-transform: translateX(-100%);
transform: translateX(-100%)
}
.ih-item.circle.effect7.left_to_right a:hover .info {
-webkit-transform: translateX(0);
-moz-transform: translateX(0);
-ms-transform: translateX(0);
-o-transform: translateX(0);
transform: translateX(0)
}
.ih-item.circle.effect7.right_to_left .info {
-webkit-transform: translateX(100%);
-moz-transform: translateX(100%);
-ms-transform: translateX(100%);
-o-transform: translateX(100%);
transform: translateX(100%)
}
.ih-item.circle.effect7.right_to_left a:hover .info {
-webkit-transform: translateX(0);
-moz-transform: translateX(0);
-ms-transform: translateX(0);
-o-transform: translateX(0);
transform: translateX(0)
}
.ih-item.circle.effect7.top_to_bottom .info {
-webkit-transform: translateY(100%);
-moz-transform: translateY(100%);
-ms-transform: translateY(100%);
-o-transform: translateY(100%);
transform: translateY(100%)
}
.ih-item.circle.effect7.top_to_bottom a:hover .info {
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
-o-transform: translateY(0);
transform: translateY(0)
}
.ih-item.circle.effect7.bottom_to_top .info {
-webkit-transform: translateY(-100%);
-moz-transform: translateY(-100%);
-ms-transform: translateY(-100%);
-o-transform: translateY(-100%);
transform: translateY(-100%)
}
.ih-item.circle.effect7.bottom_to_top a:hover .info {
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
-o-transform: translateY(0);
transform: translateY(0)
}
.ih-item.square.effect7 {
overflow: hidden
}
.ih-item.square.effect7.colored .info {
background: #1a4a72;
background: rgba(26, 74, 114, 0.6)
}
.ih-item.square.effect7.colored .info h3 {
background: rgba(12, 34, 52, 0.6)
}
.ih-item.square.effect7 .img {
-webkit-transition: all 0.35s ease-in-out;
-moz-transition: all 0.35s ease-in-out;
transition: all 0.35s ease-in-out;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1)
}
.ih-item.square.effect7 .info {
background: #333;
background: rgba(0, 0, 0, 0.6);
visibility: hidden;
opacity: 0;
-webkit-transition: all 0.35s ease-in-out;
-moz-transition: all 0.35s ease-in-out;
transition: all 0.35s ease-in-out
}
.ih-item.square.effect7 .info h3 {
text-transform: uppercase;
color: #fff;
text-align: center;
font-size: 17px;
padding: 10px;
background: #111;
margin: 30px 0 0 0;
-webkit-transform: scale(4);
-moz-transform: scale(4);
-ms-transform: scale(4);
-o-transform: scale(4);
transform: scale(4);
-webkit-transition: all 0.35s 0.1s ease-in-out;
-moz-transition: all 0.35s 0.1s ease-in-out;
transition: all 0.35s 0.1s ease-in-out
}
.ih-item.square.effect7 .info p {
font-style: italic;
font-size: 12px;
position: relative;
color: #bbb;
padding: 20px 20px 20px;
text-align: center;
-webkit-transform: scale(5);
-moz-transform: scale(5);
-ms-transform: scale(5);
-o-transform: scale(5);
transform: scale(5);
-webkit-transition: all 0.35s 0.3s linear;
-moz-transition: all 0.35s 0.3s linear;
transition: all 0.35s 0.3s linear
}
.ih-item.square.effect7 a:hover .img {
-webkit-transform: scale(1.2);
-moz-transform: scale(1.2);
-ms-transform: scale(1.2);
-o-transform: scale(1.2);
transform: scale(1.2)
}
.ih-item.square.effect7 a:hover .info {
visibility: visible;
opacity: 1
}
.ih-item.square.effect7 a:hover .info h3,
.ih-item.square.effect7 a:hover .info p {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1)
}
<link type="text/css" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<div class="container">
<div class="row">
<div class="col-sm-6">
<div class="ih-item square colored effect7">
<a href="#">
<div class="img">
<img src="http://gudh.github.io/ihover/dist/images/assets/rect/4.jpg" alt="img">
</div>
<div class="info">
<h3>Electrician</h3>
<p>Need an electrician?<!--click here-->
</p>
</div>
</a>
</div>
</div>
</div>

How to bring specific element above another

When I'm hovering specific menu option, then submenu options are blocked by slideshow element. Please refer below screenshot
Highlighted in red color submenu option is blocked by slideshow. When I changed z-index value for slideshow div to negative value then it is totally disappeared otherwise it is blocking submenu.
Please let me know, if any additional information required.
Menu.css
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
ul:after, header:after, #main:after {
clear: both;
content: "";
display: table;
}
ul:before, header:before, #main:before {
content: "";
display: table;
}
ul {
list-style: none;
padding: 0;
margin: 0;
}
body {
font-family: "Raleway";
font-weight: 400;
color: #34495E;
background: #f0f0f0;
}
header {
background: #2d3f51;
padding: 0 7%;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
box-shadow: 0 2px 5px rgba(68, 68, 68, 0.3);
-webkit-perspective: 1555px;
-moz-perspective: 1555px;
perspective: 1555px;
}
#main {
padding: 2.5em 7%;
}
#main .efx-info {
width: 49%;
float: left;
padding: 2em 1em;
font-weight: 700;
border-radius: .2em;
}
#main .efx-info h1 {
line-height: 1;
display: inline-block;
padding: .1em .2em;
font-size: 5em;
margin: 0;
background: #e3e3e3;
}
#main .efx-info p {
margin: 0;
}
#main #efx-name {
color: #16A085;
font-weight: 900;
border-bottom: 4px solid #f5f5f5;
}
#main #efx-ease {
color: #34495E;
}
#main .menu-chks {
position: relative;
line-height: 1;
font-size: .9em;
width: 45%;
float: right;
}
#main .menu-chks input {
margin-right: .5em;
}
#main .menu-chks input:checked + span {
color: #16A085;
}
#main .menu-chks input:checked + span:before {
content: "\f046";
}
#main .menu-chks span {
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
transition: all 0.2s ease;
}
#main .menu-chks span:before {
font-family: 'FontAwesome';
position: absolute;
left: 12px;
top: 10px;
color: #3b536b;
content: "\f096";
font-size: 1.4em;
}
#main .menu-chks label {
color: #e8e8e8;
font-weight: 600;
display: inline-block;
position: relative;
margin: .25em;
background: #2d3f51;
padding: .8em 1.2em .8em 2.5em;
border-radius: .4em;
}
#main .menu-chks label:hover {
cursor: pointer;
}
nav li {
position: relative;
display: inline-block;
float: left;
}
nav a {
position: relative;
/*z-index: 599;*/
color: #f5f5f5;
background: #2d3f51;
text-decoration: none;
display: block;
padding: 1.5em;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
transition: all 0.2s ease;
}
nav a i[class*="caret"] {
color: #3b536b;
margin-left: .15em;
}
nav a:hover {
color: #16A085;
}
nav a:hover + .submenu {
opacity: 1;
-webkit-transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
-ms-transform: rotateX(0deg);
-o-transform: rotateX(0deg);
transform: rotateX(0deg);
visibility: visible;
}
nav .eiob .submenu {
-webkit-transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.2s linear;
-moz-transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.2s linear;
transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.2s linear;
}
nav .ln .submenu {
-webkit-transition: all 0.3s linear;
-moz-transition: all 0.3s linear;
transition: all 0.3s linear;
}
nav .ei .submenu {
-webkit-transition: all 0.3s ease-in, opacity 0.2s linear;
-moz-transition: all 0.3s ease-in, opacity 0.2s linear;
transition: all 0.3s ease-in, opacity 0.2s linear;
}
nav .eo .submenu {
-webkit-transition: all 0.3s ease-out, opacity 0.2s linear;
-moz-transition: all 0.3s ease-out, opacity 0.2s linear;
transition: all 0.3s ease-out, opacity 0.2s linear;
}
nav .submenu {
display: block;
opacity: 0;
position: absolute;
visibility: hidden;
/* z-index: 499;*/
width: 14em;
top: 100%;
left: 0;
background: #2d3f51;
box-shadow: 0 2px 5px rgba(68, 68, 68, 0.3);
-webkit-transform-origin: top center;
-moz-transform-origin: top center;
-ms-transform-origin: top center;
-o-transform-origin: top center;
transform-origin: top center;
-webkit-transform: rotateX(-90deg);
-moz-transform: rotateX(-90deg);
-ms-transform: rotateX(-90deg);
-o-transform: rotateX(-90deg);
transform: rotateX(-90deg);
-webkit-transition: all 0.25s ease;
-moz-transition: all 0.25s ease;
transition: all 0.25s ease;
}
nav .submenu li > .submenu {
top: 0;
left: 100%;
}
nav .submenu:hover {
opacity: 1;
-webkit-transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
-ms-transform: rotateX(0deg);
-o-transform: rotateX(0deg);
transform: rotateX(0deg);
visibility: visible;
}
nav .submenu li {
float: none;
display: block;
}
nav .submenu a {
width: 100%;
display: block;
font-weight: 300;
padding: 1.4em 2em;
}
nav .submenu a:hover {
color: #f5f5f5;
background: #14957c;
}
nav.rx li:hover + .submenu {
opacity: 1;
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
transform: rotateY(0deg);
}
nav.rx .submenu {
-webkit-transform: rotateY(-90deg);
-moz-transform: rotateY(-90deg);
-ms-transform: rotateY(-90deg);
-o-transform: rotateY(-90deg);
transform: rotateY(-90deg);
}
nav.rx .submenu:hover {
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
transform: rotateY(0deg);
}
/*=== Fade Dwn ===*/
nav.fd li:hover + .submenu {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
nav.fd .submenu {
-webkit-transform-origin: center center;
-moz-transform-origin: center center;
-ms-transform-origin: center center;
-o-transform-origin: center center;
transform-origin: center center;
-webkit-transform: translateY(-50px);
-moz-transform: translateY(-50px);
-ms-transform: translateY(-50px);
-o-transform: translateY(-50px);
transform: translateY(-50px);
}
nav.fd .submenu:hover {
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
nav.fu li:hover + .submenu {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
nav.fu .submenu {
-webkit-transform-origin: center center;
-moz-transform-origin: center center;
-ms-transform-origin: center center;
-o-transform-origin: center center;
transform-origin: center center;
-webkit-transform: translateY(20px);
-moz-transform: translateY(20px);
-ms-transform: translateY(20px);
-o-transform: translateY(20px);
transform: translateY(20px);
}
nav.fu .submenu:hover {
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
/*=== Scale ===*/
nav.sc li:hover + .submenu {
opacity: 1;
-webkit-transform: rotateY(0deg) scale(1);
-moz-transform: rotateY(0deg) scale(1);
-ms-transform: rotateY(0deg) scale(1);
-o-transform: rotateY(0deg) scale(1);
transform: rotateY(0deg) scale(1);
}
nav.sc .submenu {
-webkit-transform-origin: center top;
-moz-transform-origin: center top;
-ms-transform-origin: center top;
-o-transform-origin: center top;
transform-origin: center top;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-ms-transform: scale(0);
-o-transform: scale(0);
transform: scale(0);
}
nav.sc .submenu:hover {
-webkit-transform: rotateY(0deg) scale(1);
-moz-transform: rotateY(0deg) scale(1);
-ms-transform: rotateY(0deg) scale(1);
-o-transform: rotateY(0deg) scale(1);
transform: rotateY(0deg) scale(1);
}
/*==== Rotate ====*/
nav.rt li:hover + .submenu {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
nav.rt .submenu {
-webkit-transform-origin: center center;
-moz-transform-origin: center center;
-ms-transform-origin: center center;
-o-transform-origin: center center;
transform-origin: center center;
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
}
nav.rt .submenu:hover {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
/*==== Move/Skew In ====*/
nav.mv li:hover + .submenu {
-webkit-transform: translateX(0px) skewX(0deg);
-moz-transform: translateX(0px) skewX(0deg);
-ms-transform: translateX(0px) skewX(0deg);
-o-transform: translateX(0px) skewX(0deg);
transform: translateX(0px) skewX(0deg);
}
nav.mv .submenu {
-webkit-transform-origin: center center;
-moz-transform-origin: center center;
-ms-transform-origin: center center;
-o-transform-origin: center center;
transform-origin: center center;
-webkit-transform: translateX(-40px) skewX(-7deg);
-moz-transform: translateX(-40px) skewX(-7deg);
-ms-transform: translateX(-40px) skewX(-7deg);
-o-transform: translateX(-40px) skewX(-7deg);
transform: translateX(-40px) skewX(-7deg);
}
nav.mv .submenu:hover {
-webkit-transform: skewX(0deg);
-moz-transform: skewX(0deg);
-ms-transform: skewX(0deg);
-o-transform: skewX(0deg);
transform: skewX(0deg);
}
/*==== Door ====*/
nav.dc li:hover + .submenu {
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
transform: rotateY(0deg);
}
nav.dc .submenu {
-webkit-transform-origin: left top;
-moz-transform-origin: left top;
-ms-transform-origin: left top;
-o-transform-origin: left top;
transform-origin: left top;
-webkit-transform: rotateY(-90deg);
-moz-transform: rotateY(-90deg);
-ms-transform: rotateY(-90deg);
-o-transform: rotateY(-90deg);
transform: rotateY(-90deg);
}
nav.dc .submenu:hover {
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
transform: rotateY(0deg);
}
index.html
<!DOCTYPE html>
<!--[if lte IE 9 ]><html class="ie lt-ie9" lang="en-US"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en-US"> <!--<![endif]-->
<head>
<meta charset='UTF-8'>
<script src="js/modernizr.js" type="text/javascript"></script>
<link href="css/font-awesome.min.css" rel="stylesheet">
<link rel='stylesheet prefetch' href='css/normalize.css'>
<link rel='stylesheet' href='css/menu.css'>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel='stylesheet' id='flatsome-css-minified-css' href='css/flatsome.min.css' type='text/css' media='all' />
</head>
<body>
<header >
<nav id="nav" class="ry" >
<ul id="main-menu" >
<li>
<i class="fa fa-home"></i> Home
</li>
<li>
<i class="fa fa-user"></i> About <i class="fa fa-caret-down"></i>
<ul class="submenu">
<li>Meet the Team</li>
<li>Careers</li>
<li>
More Items <i class="fa fa-caret-right"></i>
<ul class="submenu">
<li>A Sub-Item</li>
<li>
A Sub-Item
</li>
<li>
A Sub-Item
</li>
</ul>
</li>
</ul>
</li>
<li>
<i class="fa fa-shopping-cart"></i> Our Books <i class="fa fa-caret-down"></i>
<ul class="submenu">
<li>Lorem</li>
<li>Aliquam</li>
<li>Vestibulum</li>
<li>Ipsum</li>
<li>Consectetur</li>
</ul>
</li>
<li>
<i class="fa fa-comment"></i> Contact Us
</li>
</ul>
</nav>
</header>
<div id="wrapper" class="box-shadow" >
<div class="header-wrapper before-sticky">
</div><!-- .header-wrapper -->
<div id="main-content" class="site-main hfeed light">
<!-- woocommerce message -->
<div id="content" role="main">
<div class="ux-slider-wrapper relative" >
<div class="ux-slider iosSlider hide-for-small slider-style-normal slider-nav-dark slider-nav-inside slider-nav-circle js-flickity"
data-flickity-options='{
"cellAlign": "center",
"imagesLoaded": true,
"lazyLoad": 1,
"freeScroll": false,
"wrapAround": true,
"autoPlay": 6000,
"prevNextButtons": true,
"contain" : true,
"percentPosition": true,
"pageDots": true,
"selectedAttraction" : 0.1,
"friction": 0.6,
"rightToLeft": false,
"draggable": true }'
style=""
>
<div id="banner_1261757255" class="ux_banner dark " style="height:325px; " data-height="325px" role="banner">
<a href="http://xxxxx.com/up-board-books/" > <div class="banner-bg " style="background-image:url('http://www.natgen.org/wp-content/uploads/2015/07/bar2.png'); "><img src="images/uttar-pradesh-book-Banner.jpg" alt="" style="visibility:hidden;" /></div>
<div class="banner-effect effect-sparkle"></div>
<div class="row" >
<div class="inner center text-center " style="width:60%;">
<div class="inner-wrap animated fadeIn" style=" ">
</div>
</div>
</div>
</a> </div><!-- end .ux_banner -->
<div id="banner_219276103" class="ux_banner dark " style="height:325px; " data-height="325px" role="banner">
<a href="http://xxxxx.com/product-category/competition-books/magazines/" > <div class="banner-bg " style="background-image:url('images/current-affairs.jpg'); "><img src="images/current-affairs.jpg" alt="" style="visibility:hidden;" /></div>
<div class="banner-effect effect-sparkle"></div>
<div class="row" >
<div class="inner center text-center " style="width:60%;">
<div class="inner-wrap animated fadeIn" style=" ">
</div>
</div>
</div>
</a> </div><!-- end .ux_banner -->
</div>
<div class="ux-loading dark"></div>
</div><!-- .ux-slider-wrapper -->
</div>
</div><!-- #main-content -->
</div><!-- #wrapper -->
<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/flatsome.min.js'></script>
</body></html>
You must try z- index for sub menu.
It's hard to make anything up from only your CSS without HTML, but it looks like your z-index is just not high enough. A higher (positive) z-index brings an element to front, a negative z-index brings an element further back. Remember that z-index only works with positioned elements. I see that your submenu is positioned absolute, to that shouldn't be a problem. What is the z-index of your slideshow? Is this generated with JavaScript, setting a very high z-index? Try setting the z-index of your submenu to a very high number (9999999 or so) and see what happens.
Edit: I see your HTML now. Just try to increase your z-index to a very high number and see what happens. Everything else looks alright to me.

How do I make this style an external CSS/SCSS file?

I have a peculiar code here for a Javascript dropdown menu, but I think it uses some kind of dynamic CSS.
After much tinkering I got the darn thing working. The thing is, I need the CSS to be a seperate file to import into the HTML document. This is where things get tricky. I have no idea what kind of code this is as I've never worked with it before. Does anyone have any idea how I can link this CSS to my HTML document externally?
<style class="cp-pen-styles">#import url("http://fonts.googleapis.com/css?family=Lato:300,400,700,900");
#import url(http://fonts.googleapis.com/css?family=Pacifico);
body {
font-family: "Lato", Helvetica, Arial;
font-size: 16px;
}
.text-center {
text-align: center;
}
*, *:before, *:after {
-webkit-border-sizing: border-box;
-moz-border-sizing: border-box;
border-sizing: border-box;
}
.container {
width: 350px;
margin: 50px auto;
}
.container > ul {
list-style: none;
padding: 0;
margin: 0 0 20px 0;
}
.title {
font-family: 'Pacifico';
font-weight: norma;
font-size: 40px;
text-align: center;
line-height: 1.4;
color: #2980B9;
}
.dropdown a {
text-decoration: none;
}
.dropdown [data-toggle="dropdown"] {
position: relative;
display: block;
color: black;
background: #E6E6E6;
-moz-box-shadow: 0 1px 0 #EDEDED inset, 0 -1px 0 #C0C0C0 inset;
-webkit-box-shadow: 0 1px 0 #EDEDED inset, 0 -1px 0 #C0C0C0 inset;
box-shadow: 0 1px 0 #EDEDED inset, 0 -1px 0 #C0C0C0 inset;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
padding: 10px;
}
.dropdown [data-toggle="dropdown"]:hover {
background: #C0C0C0;
}
.dropdown .icon-arrow {
position: absolute;
display: block;
font-size: 0.7em;
color: #fff;
top: 14px;
right: 10px;
}
.dropdown .icon-arrow.open {
-moz-transform: rotate(-180deg);
-ms-transform: rotate(-180deg);
-webkit-transform: rotate(-180deg);
transform: rotate(-180deg);
-moz-transition: -moz-transform 0.6s;
-o-transition: -o-transform 0.6s;
-webkit-transition: -webkit-transform 0.6s;
transition: transform 0.6s;
}
.dropdown .icon-arrow.close {
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
-moz-transition: -moz-transform 0.6s;
-o-transition: -o-transform 0.6s;
-webkit-transition: -webkit-transform 0.6s;
transition: transform 0.6s;
}
.dropdown .icon-arrow:before {
content: '\25BC';
}
.dropdown .dropdown-menu {
max-height: 0;
overflow: hidden;
list-style: none;
padding: 0;
margin: 0;
}
.dropdown .dropdown-menu li {
padding: 0;
}
.dropdown .dropdown-menu li a {
display: block;
color: #6e6e6e;
background: #EEE;
-moz-box-shadow: 0 1px 0 white inset, 0 -1px 0 #d4d4d4 inset;
-webkit-box-shadow: 0 1px 0 white inset, 0 -1px 0 #d4d4d4 inset;
box-shadow: 0 1px 0 white inset, 0 -1px 0 #d4d4d4 inset;
text-shadow: 0 -1px 0 rgba(255, 255, 255, 0.3);
padding: 10px 10px;
}
.dropdown .dropdown-menu li a:hover {
background: #f6f6f6;
}
.dropdown .dropdown-menu li ul li a {
display: block;
color: #6e6e6e;
background: #EEE;
-moz-box-shadow: 0 1px 0 white inset, 0 -1px 0 #d4d4d4 inset;
-webkit-box-shadow: 0 1px 0 white inset, 0 -1px 0 #d4d4d4 inset;
box-shadow: 0 1px 0 white inset, 0 -1px 0 #d4d4d4 inset;
text-shadow: 0 -1px 0 rgba(255, 255, 255, 0.3);
padding: 10px 10px;
}
.dropdown .dropdown-menu li ul li a:hover {
background: #f6f6f6;
}
.dropdown .show, .dropdown .hide {
-moz-transform-origin: 50% 0%;
-ms-transform-origin: 50% 0%;
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
}
.dropdown .show {
display: block;
max-height: 9999px;
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
animation: showAnimation 0.5s ease-in-out;
-moz-animation: showAnimation 0.5s ease-in-out;
-webkit-animation: showAnimation 0.5s ease-in-out;
-moz-transition: max-height 1s ease-in-out;
-o-transition: max-height 1s ease-in-out;
-webkit-transition: max-height 1s ease-in-out;
transition: max-height 1s ease-in-out;
}
.dropdown .hide {
max-height: 0;
-moz-transform: scaleY(0);
-ms-transform: scaleY(0);
-webkit-transform: scaleY(0);
transform: scaleY(0);
animation: hideAnimation 0.4s ease-out;
-moz-animation: hideAnimation 0.4s ease-out;
-webkit-animation: hideAnimation 0.4s ease-out;
-moz-transition: max-height 0.6s ease-out;
-o-transition: max-height 0.6s ease-out;
-webkit-transition: max-height 0.6s ease-out;
transition: max-height 0.6s ease-out;
}
#keyframes showAnimation {
0% {
-moz-transform: scaleY(0.1);
-ms-transform: scaleY(0.1);
-webkit-transform: scaleY(0.1);
transform: scaleY(0.1);
}
40% {
-moz-transform: scaleY(1.04);
-ms-transform: scaleY(1.04);
-webkit-transform: scaleY(1.04);
transform: scaleY(1.04);
}
60% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.04);
-ms-transform: scaleY(1.04);
-webkit-transform: scaleY(1.04);
transform: scaleY(1.04);
}
100% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.02);
-ms-transform: scaleY(1.02);
-webkit-transform: scaleY(1.02);
transform: scaleY(1.02);
}
100% {
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
}
#-moz-keyframes showAnimation {
0% {
-moz-transform: scaleY(0.1);
-ms-transform: scaleY(0.1);
-webkit-transform: scaleY(0.1);
transform: scaleY(0.1);
}
40% {
-moz-transform: scaleY(1.04);
-ms-transform: scaleY(1.04);
-webkit-transform: scaleY(1.04);
transform: scaleY(1.04);
}
60% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.04);
-ms-transform: scaleY(1.04);
-webkit-transform: scaleY(1.04);
transform: scaleY(1.04);
}
100% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.02);
-ms-transform: scaleY(1.02);
-webkit-transform: scaleY(1.02);
transform: scaleY(1.02);
}
100% {
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
}
#-webkit-keyframes showAnimation {
0% {
-moz-transform: scaleY(0.1);
-ms-transform: scaleY(0.1);
-webkit-transform: scaleY(0.1);
transform: scaleY(0.1);
}
40% {
-moz-transform: scaleY(1.04);
-ms-transform: scaleY(1.04);
-webkit-transform: scaleY(1.04);
transform: scaleY(1.04);
}
60% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.04);
-ms-transform: scaleY(1.04);
-webkit-transform: scaleY(1.04);
transform: scaleY(1.04);
}
100% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.02);
-ms-transform: scaleY(1.02);
-webkit-transform: scaleY(1.02);
transform: scaleY(1.02);
}
100% {
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
}
#keyframes hideAnimation {
0% {
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
60% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.02);
-ms-transform: scaleY(1.02);
-webkit-transform: scaleY(1.02);
transform: scaleY(1.02);
}
100% {
-moz-transform: scaleY(0);
-ms-transform: scaleY(0);
-webkit-transform: scaleY(0);
transform: scaleY(0);
}
}
#-moz-keyframes hideAnimation {
0% {
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
60% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.02);
-ms-transform: scaleY(1.02);
-webkit-transform: scaleY(1.02);
transform: scaleY(1.02);
}
100% {
-moz-transform: scaleY(0);
-ms-transform: scaleY(0);
-webkit-transform: scaleY(0);
transform: scaleY(0);
}
}
#-webkit-keyframes hideAnimation {
0% {
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
60% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.02);
-ms-transform: scaleY(1.02);
-webkit-transform: scaleY(1.02);
transform: scaleY(1.02);
}
100% {
-moz-transform: scaleY(0);
-ms-transform: scaleY(0);
-webkit-transform: scaleY(0);
transform: scaleY(0);
}
}
</style>
What do I need to keep in the HTML document to link it to the CSS document, and what do I need to save in the CSS document? You can't put the imports in a CSS document.
I already tried to save everything strating from body (..};til </script> and then making the code in the HTML:
<style class="cp-pen-styles" src="dropstyle.">#import url("http://fonts.googleapis.com/css?family=Lato:300,400,700,900");
#import url(http://fonts.googleapis.com/css?family=Pacifico);
</style>
But that did not work for me. Any suggestions?
Taking Darren's comment and adding it here, put the link to your style sheet inside the head section like this:
<link rel="stylesheet" type="text/css" href="/path/to/the/file.css"/>
My part: To link your fonts add this to your head section:
<link href='https://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'>
Just so wee can close this question :)
To link the CSS code you have posted here to a HTML document you need to do a few things.
1: Create a file with the name main.css (make sure you put it inside the same folder as the HTML file you want to link to).
2: Paste the CSS code into the main.css document you have just created
3: Go to the top of the HTML document you wish to link it to and do the following inside the head of the HTML doc.
<link rel="stylesheet" href="main.css">
Actually, your fonts imports can stay in you css file. However, in the CSS file you should NOT have the <style class="cp-pen-styles"> and </style> tags. Put everything in between them in the CSS file and then like the others mentioned, add the line below to the header:
<link rel="stylesheet" type="text/css" href="/path/to/the/file.css"/>
So your CSS file will look like this:
#import url("http://fonts.googleapis.com/css?family=Lato:300,400,700,900");
#import url(http://fonts.googleapis.com/css?family=Pacifico);
body {
font-family: "Lato", Helvetica, Arial;
font-size: 16px;
}
.text-center {
text-align: center;
}
*, *:before, *:after {
-webkit-border-sizing: border-box;
-moz-border-sizing: border-box;
border-sizing: border-box;
}
.container {
width: 350px;
margin: 50px auto;
}
.container > ul {
list-style: none;
padding: 0;
margin: 0 0 20px 0;
}
.title {
font-family: 'Pacifico';
font-weight: norma;
font-size: 40px;
text-align: center;
line-height: 1.4;
color: #2980B9;
}
.dropdown a {
text-decoration: none;
}
.dropdown [data-toggle="dropdown"] {
position: relative;
display: block;
color: black;
background: #E6E6E6;
-moz-box-shadow: 0 1px 0 #EDEDED inset, 0 -1px 0 #C0C0C0 inset;
-webkit-box-shadow: 0 1px 0 #EDEDED inset, 0 -1px 0 #C0C0C0 inset;
box-shadow: 0 1px 0 #EDEDED inset, 0 -1px 0 #C0C0C0 inset;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
padding: 10px;
}
.dropdown [data-toggle="dropdown"]:hover {
background: #C0C0C0;
}
.dropdown .icon-arrow {
position: absolute;
display: block;
font-size: 0.7em;
color: #fff;
top: 14px;
right: 10px;
}
.dropdown .icon-arrow.open {
-moz-transform: rotate(-180deg);
-ms-transform: rotate(-180deg);
-webkit-transform: rotate(-180deg);
transform: rotate(-180deg);
-moz-transition: -moz-transform 0.6s;
-o-transition: -o-transform 0.6s;
-webkit-transition: -webkit-transform 0.6s;
transition: transform 0.6s;
}
.dropdown .icon-arrow.close {
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
-moz-transition: -moz-transform 0.6s;
-o-transition: -o-transform 0.6s;
-webkit-transition: -webkit-transform 0.6s;
transition: transform 0.6s;
}
.dropdown .icon-arrow:before {
content: '\25BC';
}
.dropdown .dropdown-menu {
max-height: 0;
overflow: hidden;
list-style: none;
padding: 0;
margin: 0;
}
.dropdown .dropdown-menu li {
padding: 0;
}
.dropdown .dropdown-menu li a {
display: block;
color: #6e6e6e;
background: #EEE;
-moz-box-shadow: 0 1px 0 white inset, 0 -1px 0 #d4d4d4 inset;
-webkit-box-shadow: 0 1px 0 white inset, 0 -1px 0 #d4d4d4 inset;
box-shadow: 0 1px 0 white inset, 0 -1px 0 #d4d4d4 inset;
text-shadow: 0 -1px 0 rgba(255, 255, 255, 0.3);
padding: 10px 10px;
}
.dropdown .dropdown-menu li a:hover {
background: #f6f6f6;
}
.dropdown .dropdown-menu li ul li a {
display: block;
color: #6e6e6e;
background: #EEE;
-moz-box-shadow: 0 1px 0 white inset, 0 -1px 0 #d4d4d4 inset;
-webkit-box-shadow: 0 1px 0 white inset, 0 -1px 0 #d4d4d4 inset;
box-shadow: 0 1px 0 white inset, 0 -1px 0 #d4d4d4 inset;
text-shadow: 0 -1px 0 rgba(255, 255, 255, 0.3);
padding: 10px 10px;
}
.dropdown .dropdown-menu li ul li a:hover {
background: #f6f6f6;
}
.dropdown .show, .dropdown .hide {
-moz-transform-origin: 50% 0%;
-ms-transform-origin: 50% 0%;
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
}
.dropdown .show {
display: block;
max-height: 9999px;
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
animation: showAnimation 0.5s ease-in-out;
-moz-animation: showAnimation 0.5s ease-in-out;
-webkit-animation: showAnimation 0.5s ease-in-out;
-moz-transition: max-height 1s ease-in-out;
-o-transition: max-height 1s ease-in-out;
-webkit-transition: max-height 1s ease-in-out;
transition: max-height 1s ease-in-out;
}
.dropdown .hide {
max-height: 0;
-moz-transform: scaleY(0);
-ms-transform: scaleY(0);
-webkit-transform: scaleY(0);
transform: scaleY(0);
animation: hideAnimation 0.4s ease-out;
-moz-animation: hideAnimation 0.4s ease-out;
-webkit-animation: hideAnimation 0.4s ease-out;
-moz-transition: max-height 0.6s ease-out;
-o-transition: max-height 0.6s ease-out;
-webkit-transition: max-height 0.6s ease-out;
transition: max-height 0.6s ease-out;
}
#keyframes showAnimation {
0% {
-moz-transform: scaleY(0.1);
-ms-transform: scaleY(0.1);
-webkit-transform: scaleY(0.1);
transform: scaleY(0.1);
}
40% {
-moz-transform: scaleY(1.04);
-ms-transform: scaleY(1.04);
-webkit-transform: scaleY(1.04);
transform: scaleY(1.04);
}
60% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.04);
-ms-transform: scaleY(1.04);
-webkit-transform: scaleY(1.04);
transform: scaleY(1.04);
}
100% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.02);
-ms-transform: scaleY(1.02);
-webkit-transform: scaleY(1.02);
transform: scaleY(1.02);
}
100% {
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
}
#-moz-keyframes showAnimation {
0% {
-moz-transform: scaleY(0.1);
-ms-transform: scaleY(0.1);
-webkit-transform: scaleY(0.1);
transform: scaleY(0.1);
}
40% {
-moz-transform: scaleY(1.04);
-ms-transform: scaleY(1.04);
-webkit-transform: scaleY(1.04);
transform: scaleY(1.04);
}
60% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.04);
-ms-transform: scaleY(1.04);
-webkit-transform: scaleY(1.04);
transform: scaleY(1.04);
}
100% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.02);
-ms-transform: scaleY(1.02);
-webkit-transform: scaleY(1.02);
transform: scaleY(1.02);
}
100% {
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
}
#-webkit-keyframes showAnimation {
0% {
-moz-transform: scaleY(0.1);
-ms-transform: scaleY(0.1);
-webkit-transform: scaleY(0.1);
transform: scaleY(0.1);
}
40% {
-moz-transform: scaleY(1.04);
-ms-transform: scaleY(1.04);
-webkit-transform: scaleY(1.04);
transform: scaleY(1.04);
}
60% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.04);
-ms-transform: scaleY(1.04);
-webkit-transform: scaleY(1.04);
transform: scaleY(1.04);
}
100% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.02);
-ms-transform: scaleY(1.02);
-webkit-transform: scaleY(1.02);
transform: scaleY(1.02);
}
100% {
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
}
#keyframes hideAnimation {
0% {
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
60% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.02);
-ms-transform: scaleY(1.02);
-webkit-transform: scaleY(1.02);
transform: scaleY(1.02);
}
100% {
-moz-transform: scaleY(0);
-ms-transform: scaleY(0);
-webkit-transform: scaleY(0);
transform: scaleY(0);
}
}
#-moz-keyframes hideAnimation {
0% {
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
60% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.02);
-ms-transform: scaleY(1.02);
-webkit-transform: scaleY(1.02);
transform: scaleY(1.02);
}
100% {
-moz-transform: scaleY(0);
-ms-transform: scaleY(0);
-webkit-transform: scaleY(0);
transform: scaleY(0);
}
}
#-webkit-keyframes hideAnimation {
0% {
-moz-transform: scaleY(1);
-ms-transform: scaleY(1);
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
60% {
-moz-transform: scaleY(0.98);
-ms-transform: scaleY(0.98);
-webkit-transform: scaleY(0.98);
transform: scaleY(0.98);
}
80% {
-moz-transform: scaleY(1.02);
-ms-transform: scaleY(1.02);
-webkit-transform: scaleY(1.02);
transform: scaleY(1.02);
}
100% {
-moz-transform: scaleY(0);
-ms-transform: scaleY(0);
-webkit-transform: scaleY(0);
transform: scaleY(0);
}
}