How to retain my current css if i use bootstrap - html

Hi I want to use <span class="glyphicon glyphicon-print"></span>
but to do it i need to put a bootstrap below
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
the problem is, my current table and some h1 text is changing the size or design if I put that bootstrap, what should I do? Any idea?
The resut is on this picture
With Bootstrap the icon of gly is working
but this is my default and i want the size of this table Without Bootstrap
my css is here
html {
height: 100%;
}
body{
height: 100%;
position: relative;
margin: 0;
background: -webkit-linear-gradient(left, #25c481, #25b7c4);
background: linear-gradient(45deg, rgba(66, 183, 245, 0.8) 0%, rgba(66, 245, 189, 0.4) 100%);
font-family: 'Roboto', sans-serif;
background-repeat: no-repeat;
background-attachment: fixed;
}
table{
width:100%;
table-layout: auto;
}
.tbl-header{
position: relative;
background-color: rgba(255,255,255,0.3);
top: -45px;
}
.tbl-content{
height:300px;
overflow-x:auto;
margin-top: 0px;
border: 1px solid rgba(255,255,255,0.3);
}
th{
padding: 20px 15px;
text-align: left;
font-weight: 500;
font-size: 12px;
color: #fff;
background: black;
text-transform: uppercase;
}
td{
padding: 15px;
text-align: left;
vertical-align:middle;
font-weight: 300;
font-size: 12px;
color: #fff;
border-bottom: solid 1px rgba(255,255,255,0.1);
}
#import url(https://fonts.googleapis.com/css?family=Roboto:400,500,300,700);
section{
margin: 50px;
}
::-webkit-scrollbar {
width: 6px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}
::-webkit-scrollbar-thumb {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}
*, *:before, *:after {
-webkit-tap-highlight-color: transparent;
-webkit-tap-highlight-color: rgba(0,0,0,0);
user-select: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
box-sizing: border-box;
-webkit-box-sizing: border-box;
padding: 0;
margin: 0;
}
a, a:visited, a:hover {
color: inherit;
text-decoration: none;
}
h1 {
position: relative;
top: -40px;
display: block;
margin: 0 auto 25px auto;
text-align: center;
font-size: 1.92em;
font-weight: 600;
letter-spacing: -0.055em;
font-family: Raleway, sans-serif;
text-transform: uppercase;
letter-spacing: 3px;
line-height: 48px;
color: #03e9f4;
text-shadow: 0px 1px black;
}
h2 {
display: block;
margin: 0 auto 60px auto;
text-align: center;
font-weight: 400;
font-size: 1.25em;
letter-spacing: -0.015em;
}
.container {
position: relative;
margin: calc(75px + 2vh + 2vw) auto 0 auto;
padding: 0;
width: 100%;
max-width: 840px;
}
.search-box {
top: -40px;
position: relative;
width: 100%;
max-width: 360px;
height: 60px;
border-radius: 120px;
margin: 0 auto;
}
.search-box1 {
top: -60px;
position: relative;
width: 33%;
max-width: 300px;
height: 40px;
margin: 0 auto;
justify-content: center;
align-items: center;
text-align: center;
display: flex;
}
input[type="text"]{ padding: 10px 10px; line-height: 5px; }
.search-icon, .go-icon {
position: absolute;
top: 0;
height: 60px;
width: 86px;
line-height: 61px;
text-align: center;
}
.search-icon {
left: 0;
pointer-events: none;
font-size: 1.22em;
will-change: transform;
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform-origin: center center;
-webkit-transform-origin: center center;
-moz-transform-origin: center center;
-o-transform-origin: center center;
transition: transform 400ms 220ms cubic-bezier(0.190, 1.000, 0.220, 1.000);
-webkit-transition: transform 400ms 220ms cubic-bezier(0.190, 1.000, 0.220, 1.000);
-moz-transition: transform 400ms 220ms cubic-bezier(0.190, 1.000, 0.220, 1.000);
-o-transition: transform 400ms 220ms cubic-bezier(0.190, 1.000, 0.220, 1.000);
}
.si-rotate {
transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
}
.go-icon {
right: 0;
pointer-events: none;
font-size: 1.38em;
will-change: opacity;
cursor: default;
opacity: 0;
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transition: opacity 190ms ease-out, transform 260ms cubic-bezier(0.190, 1.000, 0.220, 1.000);
-webkit-transition: opacity 190ms ease-out, transform 260ms cubic-bezier(0.190, 1.000, 0.220, 1.000);
-moz-transition: opacity 190ms ease-out, transform 260ms cubic-bezier(0.190, 1.000, 0.220, 1.000);
-o-transition: opacity 190ms ease-out, transform 260ms cubic-bezier(0.190, 1.000, 0.220, 1.000);
}
.go-in {
opacity: 1;
pointer-events: all;
cursor: pointer;
transform: rotate(0);
-webkit-transform: rotate(0);
-moz-transform: rotate(0);
-o-transform: rotate(0);
transition: opacity 190ms ease-out, transform 260ms 20ms cubic-bezier(0.190, 1.000, 0.220, 1.000);
-webkit-transition: opacity 190ms ease-out, transform 260ms 20ms cubic-bezier(0.190, 1.000, 0.220, 1.000);
-moz-transition: opacity 190ms ease-out, transform 260ms 20ms cubic-bezier(0.190, 1.000, 0.220, 1.000);
-o-transition: opacity 190ms ease-out, transform 260ms 20ms cubic-bezier(0.190, 1.000, 0.220, 1.000);
}
.search-border {
display: block;
width: 100%;
max-width: 360px;
height: 60px;
}
.border {
fill: none;
stroke: #FFFFFF;
stroke-width: 5;
stroke-miterlimit: 10;
}
.border {
stroke-dasharray: 740;
stroke-dashoffset: 0;
transition: stroke-dashoffset 400ms cubic-bezier(0.600, 0.040, 0.735, 0.990);
-webkit-transition: stroke-dashoffset 400ms cubic-bezier(0.600, 0.040, 0.735, 0.990);
-moz-transition: stroke-dashoffset 400ms cubic-bezier(0.600, 0.040, 0.735, 0.990);
-o-transition: stroke-dashoffset 400ms cubic-bezier(0.600, 0.040, 0.735, 0.990);
}
.border-searching .border {
stroke-dasharray: 740;
stroke-dashoffset: 459;
transition: stroke-dashoffset 650ms cubic-bezier(0.755, 0.150, 0.205, 1.000);
-webkit-transition: stroke-dashoffset 650ms cubic-bezier(0.755, 0.150, 0.205, 1.000);
-moz-transition: stroke-dashoffset 650ms cubic-bezier(0.755, 0.150, 0.205, 1.000);
-o-transition: stroke-dashoffset 650ms cubic-bezier(0.755, 0.150, 0.205, 1.000);
}
#search {
font-family: 'Montserrat Alternates', sans-serif;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 120px;
border: none;
background: rgba(255,255,255,0);
padding: 0 68px 0 68px;
color: #FFFFFF;
font-size: 1.32em;
font-weight: 400;
letter-spacing: -0.015em;
outline: none;
color:black;
}
#search::-webkit-input-placeholder {color: #FFFFFF;}
#search::-moz-placeholder {color: #FFFFFF;}
#search:-ms-input-placeholder {color: #FFFFFF;}
#search:-moz-placeholder {color: #FFFFFF;}
#search::-moz-selection {color: #FFFFFF; background: rgba(0,0,0,0.25);}
#search::selection {color: #FFFFFF; background: rgba(0,0,0,0.25);}
.submit-btn {
display: inline-block;
float:right;
background-color: #000;
color: #fff;
font-family: Raleway, sans-serif;
text-transform: uppercase;
letter-spacing: 2px;
font-size: 12px;
line-height: 24px;
padding: 8px 8px;
border: none;
cursor: pointer;
}
.submit-btn:hover {
text-decoration: underline;
background-color: white;
color: black;
border: solid;
border-width: 1px;
}

Generally speaking,
If your CSS comes after Bootstrap's, then Bootstrap is given priority and will override your CSS where possible.
If your CSS comes after Boostrap's, then in some cases, your CSS will be given priority.
Additionally, if you're planning to work with Bootstrap then being mindful of specificity moving forward can save you some headache. Plus, when all else fails and you are sure the issue is a clash between your CSS and Bootstrap then you can take a look at how that CSS rule is declared in Bootstrap CSS and that will likely give you some hint as to how to circumvent it.

Simple, just follow this pattern when you linked the bootstrap css and your custom css file to the head section.
Link bootstrap css first
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
Then link your custom css file
<link rel="stylesheet" href="css/style.css">

Related

HTML Combining 2 hover effects

Hi I am trying to combine 2 hover effects. First hover effect takes places when you hover over the button, the other one is when you hover over the arrow. I am trying to combine those 2 hover effects to take place simultaneously. Could anyone please help me with that? Thank you so much
.btnMain {
padding: 15px 110px;
text-align: center;
transition: 0.5s;
background-size: 200% auto;
color: white;
box-shadow: 0 0 20px #eee;
border-radius: 10px;
font-weight: 600;
text-transform: uppercase;
letter-spacing:1px;
margin-top:40px;
font-size:16px;
display: inline-block;
border: 2px;
font-family: "Raleway", sans-serif;
cursor: pointer;
moz-transition: all .4s ease-in-out;
}
.btnMain:hover {
background-position: 100% 0;
color:#fff;
moz-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.gradient {
background-image: linear-gradient(to right, #25aae1, #4481eb, #04befe, #3f86ed);
box-shadow: 0 4px 15px 0 rgb(65 132 234 / 75%);
}
.arrowIntro {
color: black;
font-size:60px;
margin-left:-2%;
}
.arrowIntro::before {
display: inline-block;
padding-left: -8px;
content: "🠒";
transition: transform 0.3s ease-out;
position: relative;
top: 16px;
left: 3px;
}
.arrowIntro:hover {
color: black;
}
.arrowIntro:hover::before {
transform: translateX(12px);
}
Contact me<a id="arrowIntroId" href="#kontakt" class="arrowIntro"></a>
Please refer to CSS Transform Modules. Also, a technicality: You were trying to move the arrow on .arrowIntro:hover while you wanted it to move on .btnMain:hover
.btnMain {
padding: 15px 110px;
text-align: center;
transition: 0.5s;
background-size: 200% auto;
color: white;
box-shadow: 0 0 20px #eee;
border-radius: 10px;
font-weight: 600;
text-transform: uppercase;
letter-spacing:1px;
margin-top:40px;
font-size:16px;
display: inline-block;
border: 2px;
font-family: "Raleway", sans-serif;
cursor: pointer;
moz-transition: all .4s ease-in-out;
position: relative;
}
.btnMain:hover {
background-position: 100% 0;
color:#fff;
moz-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.gradient {
background-image: linear-gradient(to right, #25aae1, #4481eb, #04befe, #3f86ed);
box-shadow: 0 4px 15px 0 rgb(65 132 234 / 75%);
}
.arrowIntro {
margin-left:10px;
display:inline-block;
color: black;
position:absolute;
top:7px;
right:20px;
transition: transform 500ms ease-in-out 25ms;
}
.arrowIntro::before {
content: "→";
font-size:30px;
color: white;
}
.btnMain:hover .arrowIntro {
transform: translateX(12px);
color: red;
}
Contact me<div class="arrowIntro"></div>
You need to move the hover to the .btnMain element:
.btnMain:hover .arrowIntro {
color: black;
}
.btnMain:hover .arrowIntro::before {
transform: translateX(12px);
}
Also, you cannot have an a tag within another a tag. That's malformed HTML and the first a will close at the first closing a. I changed that to a span.
.btnMain {
padding: 15px 110px;
text-align: center;
transition: 0.5s;
background-size: 200% auto;
color: white;
box-shadow: 0 0 20px #eee;
border-radius: 10px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
margin-top: 40px;
font-size: 16px;
display: inline-block;
border: 2px;
font-family: "Raleway", sans-serif;
cursor: pointer;
-moz-transition: all .4s ease-in-out;
}
.btnMain:hover {
background-position: 100% 0;
color: #fff;
-moz-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.gradient {
background-image: linear-gradient(to right, #25aae1, #4481eb, #04befe, #3f86ed);
box-shadow: 0 4px 15px 0 rgb(65 132 234 / 75%);
}
.arrowIntro {
color: black;
margin-left: -2%;
}
.arrowIntro::before {
display: inline-block;
padding-left: -8px;
content: "🠒";
transition: transform 0.3s ease-out;
position: relative;
left: 4px;
}
.btnMain:hover .arrowIntro {
color: black;
}
.btnMain:hover .arrowIntro::before {
transform: translateX(12px);
}
Contact me<span id="arrowIntroId" class="arrowIntro"></span>

Change text on hover, CSS and html

I want to change the text when hovering over a speechbubble (already created) and set the text back when the mouse goes back. I have a "Welcome!" text set on the speechbubble and I want it to change to "Scroll down". The other issue is that I have set a css transformation on the speechbubble+welcome so that makes it harder..
Here's my code:
#welcome{
position:absolute;
top:50%;
left:50%;
width:auto;
height:auto;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
#speechbubble {
margin-left:110px;
width: 230px;
height: 80px;
line-height:80px;
text-align:center;
font-size:15px;
letter-spacing:2px;
-moz-box-shadow: 5px 5px 5px #888;
-webkit-box-shadow: 5px 5px 5px #888;
box-shadow: 5px 5px 5px #888;
font-family:{select:Title Font};
background: {color:Welcome background};
color:{color:Welcome text};
position: relative;
font-weight:bold;
}
#speechbubble:before {
content:"";
position: absolute;
right: 100%;
top: 26px;
width: 0;
height: 0;
border-top: 13px solid transparent;
border-right: 18px solid {color:Welcome background};
border-bottom: 13px solid transparent;
}
#welcome:hover #speechbubble{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
margin-left:120px;
}
#welcome #speechbubble{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
<div id="welcome">
<div id="speechbubble">Welcome!</div>
I've tried some tricks like adding a div for the second text and setting a css hover but it didn't work.. Can anyone help me? Thanks
You can use pseudo class :after and change its content on hover.
Like this:
#welcome {
position: absolute;
top: 50%;
left: 50%;
width: auto;
height: auto;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
#speechbubble {
margin-left: 110px;
width: 230px;
height: 80px;
line-height: 80px;
text-align: center;
font-size: 15px;
letter-spacing: 2px;
-moz-box-shadow: 5px 5px 5px #888;
-webkit-box-shadow: 5px 5px 5px #888;
box-shadow: 5px 5px 5px #888;
font-family: {
select: Title Font
}
;
background: {
color: Welcome background
}
;
color: {
color: Welcome text
}
;
position: relative;
font-weight:bold;
}
#speechbubble:after {
content: "Welcome!";
}
#speechbubble:before {
position: absolute;
right: 100%;
top: 26px;
width: 0;
height: 0;
border-top: 13px solid transparent;
border-right: 18px solid {
color: Welcome background
}
;
border-bottom: 13px solid transparent;
}
#welcome:hover #speechbubble:after {
content: "Scroll Down";
}
#welcome:hover #speechbubble {
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
margin-left: 120px;
}
#welcome #speechbubble {
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
<div id="welcome">
<div id="speechbubble"></div>
Using :after & :before try this, add this to your css:
#welcome:hover #speechbubble:after {
content: "Scroll Down";
}
#welcome:hover #speechbubble:before {
content: "";
}
#speechbubble:before {
content: "Welcome!";
}
then remove this right,top and position from your css:
#speechbubble:before {
content:"";
/*position: absolute;*/
/*right: 100%;*/
/*top: 26px;*/
width: 0;
height: 0;
border-top: 13px solid transparent;
border-right: 18px solid {color:Welcome background};
border-bottom: 13px solid transparent;
}
also remove the word Welcome:
<div id="welcome">
<div id="speechbubble"></div>
now this is the magic of CSS :)
Here is an example code using pseduo elements with data- attributes to
achieve the things:
#welcome {
position: absolute;
top: 50%;
left: 50%;
width: auto;
height: auto;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
body {
background: black;
}
/* .button */
#speechbubble {
display: inline-block;
position: relative;
margin: 1em;
padding: 0.67em;
border: 2px solid #FFF;
overflow: hidden;
text-decoration: none;
font-size: 2em;
outline: none;
color: #FFF;
background: transparent;
font-family: 'raleway', sans-serif;
}
#speechbubble span {
-webkit-transition: 0.6s;
-moz-transition: 0.6s;
-o-transition: 0.6s;
transition: 0.6s;
-webkit-transition-delay: 0.2s;
-moz-transition-delay: 0.2s;
-o-transition-delay: 0.2s;
transition-delay: 0.2s;
}
#speechbubble:before {
content: '';
position: absolute;
top: 0.67em;
left: 0;
width: 100%;
text-align: center;
opacity: 0;
-webkit-transition: .4s, opacity .6s;
-moz-transition: .4s, opacity .6s;
-o-transition: .4s, opacity .6s;
transition: .4s, opacity .6s;
}
/* :before */
#speechbubble:before {
content: attr(data-hover);
-webkit-transform: translate(-150%, 0);
-moz-transform: translate(-150%, 0);
-ms-transform: translate(-150%, 0);
-o-transform: translate(-150%, 0);
transform: translate(-150%, 0);
}
/* Span on :hover and :active */
#speechbubble:hover span {
opacity: 0;
-webkit-transform: scale(0.3);
-moz-transform: scale(0.3);
-ms-transform: scale(0.3);
-o-transform: scale(0.3);
transform: scale(0.3);
}
/*
We show :before pseudo-element on :hover
*/
#speechbubble:hover:before {
opacity: 1;
-webkit-transform: translate(0, 0);
-moz-transform: translate(0, 0);
-ms-transform: translate(0, 0);
-o-transform: translate(0, 0);
transform: translate(0, 0);
-webkit-transition-delay: .4s;
-moz-transition-delay: .4s;
-o-transition-delay: .4s;
transition-delay: .4s;
}
<div id="welcome">
<div id="speechbubble" data-hover="Scroll Down"><span>Welcome!</span></div>
</div>
Here's very basic way to do it. Just put the text in some tags, and show/hide them on hover.
Also you can use the attr and :after features from css3.
#welcome{
position:absolute;
top:50%;
left:50%;
width:auto;
height:auto;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
#speechbubble {
margin-left:110px;
width: 230px;
height: 80px;
line-height:80px;
text-align:center;
font-size:15px;
letter-spacing:2px;
-moz-box-shadow: 5px 5px 5px #888;
-webkit-box-shadow: 5px 5px 5px #888;
box-shadow: 5px 5px 5px #888;
font-family:{select:Title Font};
background: {color:Welcome background};
color:{color:Welcome text};
position: relative;
font-weight:bold;
}
#speechbubble:before {
content:"";
position: absolute;
right: 100%;
top: 26px;
width: 0;
height: 0;
border-top: 13px solid transparent;
border-right: 18px solid {color:Welcome background};
border-bottom: 13px solid transparent;
}
#welcome:hover #speechbubble{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
margin-left:120px;
}
#welcome #speechbubble .hover_on {
display: none;
}
#welcome #speechbubble .hover_off {
display: inline-block;
}
#welcome:hover #speechbubble .hover_on {
display: inline-block;
}
#welcome:hover #speechbubble .hover_off {
display: none;
}
#welcome #speechbubble{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
<div id="welcome">
<div id="speechbubble"><p class="hover_off">Welcome!</p><p class="hover_on">Scroll down!</p></div>

Text not getting center aligned in a CSS button

.button {
text-align: left;
background-color: #012839;
text-decoration: none;
text-transform: uppercase;
font-family: 'Exo 2', sans-serif;
font-weight: 200;
font-size: 30px;
display: inline-block;
position: relative;
margin-top: 50px;
margin-left: 20px;
text-align: center;
width: 50px;
color: #00c7ec;
border: 1px solid #00c7ec;
border-radius: 5px;
line-height: 3em;
padding-left: 5em;
padding-right: 5em;
box-shadow: 0 0 0 0 transparent;
-webkit-transition: all 0.2s ease-in;
-moz-transition: all 0.2s ease-in;
transition: all 0.2s ease-in;
}
.button:hover {
color: white;
box-shadow: 0 0 30px 0 rgba(0, 199, 236, 0.5);
background-color: #00c7ec;
-webkit-transition: all 0.2s ease-out;
-moz-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
}
.button:hover:before {
-webkit-animation: shine 0.5s 0s linear;
-moz-animation: shine 0.5s 0s linear;
animation: shine 0.5s 0s linear;
}
.button:active {
box-shadow: 0 0 0 0 transparent;
-webkit-transition: box-shadow 0.2s ease-in;
-moz-transition: box-shadow 0.2s ease-in;
transition: box-shadow 0.2s ease-in;
}
.button:before {
content: '';
display: block;
width: 0px;
height: 86%;
position: absolute;
top: 7%;
left: 0%;
opacity: 0;
background: white;
box-shadow: 0 0 15px 3px white;
-webkit-transform: skewX(-20deg);
-moz-transform: skewX(-20deg);
-ms-transform: skewX(-20deg);
-o-transform: skewX(-20deg);
transform: skewX(-20deg);
}
#-webkit-keyframes shine {
from {
opacity: 0;
left: 0%;
}
50% {
opacity: 1;
}
to {
opacity: 0;
left: 100%;
}
}
#-moz-keyframes shine {
from {
opacity: 0;
left: 0%;
}
50% {
opacity: 1;
}
to {
opacity: 0;
left: 100%;
}
}
#keyframes shine {
from {
opacity: 0;
left: 0%;
}
50% {
opacity: 1;
}
to {
opacity: 0;
left: 100%;
}
}
Gallery
I wanted to use this button in my personal project but the problem I am having is that the text in the button i.e. "Gallery" is not getting center aligned even after I put the "text-align:"center" in the button class.
Because of you define width 50px; now do this
add width: auto; or remove width: 50px;
as like this
.button {
text-align: left;
background-color: #012839;
text-decoration: none;
text-transform: uppercase;
font-family: 'Exo 2', sans-serif;
font-weight: 200;
font-size: 30px;
display: inline-block;
position: relative;
margin-top: 50px;
margin-left: 20px;
text-align: center;
color: #00c7ec;
border: 1px solid #00c7ec;
border-radius: 5px;
line-height: 3em;
padding-left: 5em;
padding-right: 5em;
box-shadow: 0 0 0 0 transparent;
-webkit-transition: all 0.2s ease-in;
-moz-transition: all 0.2s ease-in;
transition: all 0.2s ease-in;
}
.button:hover {
color: white;
box-shadow: 0 0 30px 0 rgba(0, 199, 236, 0.5);
background-color: #00c7ec;
-webkit-transition: all 0.2s ease-out;
-moz-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
}
.button:hover:before {
-webkit-animation: shine 0.5s 0s linear;
-moz-animation: shine 0.5s 0s linear;
animation: shine 0.5s 0s linear;
}
.button:active {
box-shadow: 0 0 0 0 transparent;
-webkit-transition: box-shadow 0.2s ease-in;
-moz-transition: box-shadow 0.2s ease-in;
transition: box-shadow 0.2s ease-in;
}
.button:before {
content: '';
display: block;
width: 0px;
height: 86%;
position: absolute;
top: 7%;
left: 0%;
opacity: 0;
background: white;
box-shadow: 0 0 15px 3px white;
-webkit-transform: skewX(-20deg);
-moz-transform: skewX(-20deg);
-ms-transform: skewX(-20deg);
-o-transform: skewX(-20deg);
transform: skewX(-20deg);
}
#-webkit-keyframes shine {
from {
opacity: 0;
left: 0%;
}
50% {
opacity: 1;
}
to {
opacity: 0;
left: 100%;
}
}
#-moz-keyframes shine {
from {
opacity: 0;
left: 0%;
}
50% {
opacity: 1;
}
to {
opacity: 0;
left: 100%;
}
}
#keyframes shine {
from {
opacity: 0;
left: 0%;
}
50% {
opacity: 1;
}
to {
opacity: 0;
left: 100%;
}
}
Gallery
Add .button { width: auto; } to get your result
change
padding-left : 5em to 2.5em
I had removed padding and added min-width:220px:
.button {
text-align: left;
background-color: #012839;
text-decoration: none;
text-transform: uppercase;
font-family: 'Exo 2', sans-serif;
font-weight: 200;
font-size: 30px;
display: inline-block;
position: relative;
margin-top: 50px;
margin-left: 20px;
text-align: center;
color: #00c7ec;
min-width: 220px; /*Here you can give any value other then 220px*/
border: 1px solid #00c7ec;
border-radius: 5px;
line-height: 3em;
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
-webkit-transition: all 0.2s ease-in;
-moz-transition: all 0.2s ease-in;
transition: all 0.2s ease-in;
}
.button:hover {
color: white;
box-shadow: 0 0 30px 0 rgba(0, 199, 236, 0.5);
background-color: #00c7ec;
-webkit-transition: all 0.2s ease-out;
-moz-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
}
.button:hover:before {
-webkit-animation: shine 0.5s 0s linear;
-moz-animation: shine 0.5s 0s linear;
animation: shine 0.5s 0s linear;
}
.button:active {
box-shadow: 0 0 0 0 transparent;
-webkit-transition: box-shadow 0.2s ease-in;
-moz-transition: box-shadow 0.2s ease-in;
transition: box-shadow 0.2s ease-in;
}
.button:before {
content: '';
display: block;
width: 0px;
height: 86%;
position: absolute;
top: 7%;
left: 0%;
opacity: 0;
background: white;
box-shadow: 0 0 15px 3px white;
-webkit-transform: skewX(-20deg);
-moz-transform: skewX(-20deg);
-ms-transform: skewX(-20deg);
-o-transform: skewX(-20deg);
transform: skewX(-20deg);
}
#-webkit-keyframes shine {
from {
opacity: 0;
left: 0%;
}
50% {
opacity: 1;
}
to {
opacity: 0;
left: 100%;
}
}
#-moz-keyframes shine {
from {
opacity: 0;
left: 0%;
}
50% {
opacity: 1;
}
to {
opacity: 0;
left: 100%;
}
}
#keyframes shine {
from {
opacity: 0;
left: 0%;
}
50% {
opacity: 1;
}
to {
opacity: 0;
left: 100%;
}
}
Gallery

Can't get these div's to center

I am trying to get these div's to center (all 3 next to each other to be in the center of the page), however I cannot get them to center.
Here is how they look, as an example: http://callum.website/
Code:
HTML
<div class="containercontainer">
<div class="containerleft">
<figure class="image-container">
<img src="https://d13yacurqjgara.cloudfront.net/users/430915/screenshots/2031943/untitled-7_1x.png" alt="eSportsy - eSports PSD Template" width="400" height="300">
<figcaption class="clearfix">
<h4>eSportsy - FREE PSD Template</h4>
<p>in <font color="0ead99"><B>FREEBIES</B></font></p>
Download
</figcaption>
</figure>
</div>
<div class="container">
<figure class="image-container">
<img src="https://d13yacurqjgara.cloudfront.net/users/430915/screenshots/2031943/untitled-7_1x.png" alt="eSportsy - eSports PSD Template" width="400" height="300">
<figcaption class="clearfix">
<h4>eSportsy - FREE PSD Template</h4>
<p>in <font color="0ead99"><B>FREEBIES</B></font></p>
Download
</figcaption>
</figure>
</div>
<div class="containerright">
<figure class="image-container">
<img src="https://d13yacurqjgara.cloudfront.net/users/430915/screenshots/2031943/untitled-7_1x.png" alt="eSportsy - eSports PSD Template" width="400" height="300">
<figcaption class="clearfix">
<h4>eSportsy - FREE PSD Template</h4>
<p>in <font color="0ead99"><B>FREEBIES</B></font></p>
Download
</figcaption>
</figure>
</div>
body{
background: #F3F3F3;
margin: 0px;
padding: 0px;
font-family: 'Open Sans', sans-serif;
color: #2A2A2A;
}
h4 {
color: #fff;
margin: 0;
padding: 0;
}
p {
margin: 0;
}
.containercontainer{
width: 66%;
margin: 0 auto;
max-width:100%;
text-align: center;
}
.containerleft {
height: 312px;
width: 412px;
font: 87.5%/1.5em sans-serif !important;
margin-top:20px;
display: inline-block;
text-align:left !important;
float:left;
}
.container {
height: 312px;
width: 412px;
font: 87.5%/1.5em sans-serif !important;
margin-top:20px;
display: inline-block;
text-align:left !important;
}
.containerright {
height: 312px;
width: 412px;
font: 87.5%/1.5em sans-serif !important;
margin-top:20px;
display: inline-block;
text-align:left !important;
float: right
}
.container a{
text-decoration:none;
}
.container img{
bottom: 0;
display: block;
height: auto;
max-width: 100%;
}
.button {
background: #0084b4;
border-radius: 3px;
color: #fff;
display: inline-block;
font-weight: bold;
padding: 4px 8px;
position: absolute;
right: 20px;
top: 30px;
}
.button:hover {
background: #2D76B9;
color: #fff;
}
.dlbutton {
background: #0ead99;
border-radius: 3px;
color: #fff;
display: inline-block;
font-weight: bold;
padding: 4px 8px;
position: absolute;
right: 20px;
top: 30px;
}
.dlbutton:hover {
background: #0eb49f;
color: #fff;
}
.image-container {
border: 6px solid #fff;
box-shadow: 0 0 5px rgba(0, 0, 0, .3);
overflow: hidden;
position: relative;
width: 400px;
}
.image-container img {
-webkit-transition: all .4s;
-moz-transition: all .4s;
-ms-transition: all .4s;
-o-transition: all .4s;
transition: all .4s;
}
.image-container:hover img {
-webkit-transform: translateY(-45px);
-moz-transform: translateY(-45px);
-ms-transform: translateY(-45px);
-o-transform: translateY(-45px);
transform: translateY(-45px);
}
.image-container:hover figcaption {
opacity: 1;
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
-o-transform: translateY(0);
transform: translateY(0);
-webkit-transition: -webkit-transform .4s, opacity .1s;
-moz-transition: -moz-transform .4s, opacity .1s;
-ms-transition: -ms-transform .4s, opacity .1s;
-o-transition: -o-transform .4s, opacity .1s;
transition: transform .4s, opacity .1s;
}
.image-container figcaption {
background: #283449;
bottom: 0;
color: #fff;
height: 50px;
left: 0;
opacity: 0;
padding: 20px;
position: absolute;
-webkit-transform: translateY(100%);
-moz-transform: translateY(100%);
-ms-transform: translateY(100%);
-o-transform: translateY(100%);
transform: translateY(100%);
-webkit-transition: -webkit-transform .4s, opacity .1s .3s;
-moz-transition: -moz-transform .4s, opacity .1s .3s;
-ms-transition: -ms-transform .4s, opacity .1s .3s;
-o-transition: -o-transform .4s, opacity .1s .3s;
transition: transform .4s, opacity .1s .3s;
width: 360px;
}
You just need to remove the margin-left from .image-container.
.image-container { margin-left:0; }
Change the size of containerright (from CSS) from 66% to 92%. This will align all the divs in center as well as wouldn't disturb page responsiveness.
Remove:
float: left;
float: right;
and they become centered.
.containerright {
height: 312px;
width: 412px;
font: 87.5%/1.5em sans-serif !important;
margin-top:20px;
display: inline-block;
text-align:left !important;
...
margin:0 auto; // add this
}
Do the same for other container too Which is in centre

Making off-canvas sliding menu with css

I want to make a sliding menu using solely CSS. The menu will reveal a list of items and a close button inside it. I currently have an anchor tag on my homepage that is styled correctly, but it does not do anything when clicked.
HTML:
<body class="homepage body-push">
<!-- Menu -->
<nav class="menu" id="theMenu">
<div class="menu-wrap">
<h1 class="logo">Focus</h1>
<i class="icon-remove menu-close"></i>
Home
Services
Process
Portfolio
About
Contact
<i class="icon-facebook"></i>
<i class="icon-twitter"></i>
<i class="icon-dribbble"></i>
<i class="icon-envelope"></i>
</div>
<!-- Menu button -->
<div id="menuToggle"><i class="icon-reorder"></i></div>
</nav>
</body>
CSS:
.menu {
position: fixed;
right: -200px;
width: 260px;
height: 100%;
top: 0;
z-index: 10;
text-align: left;
}
.menu.menu-open {
right: 0px;
}
.menu-wrap {
position: absolute;
top: 0;
left: 60px;
background: #1a1a1a;
width: 200px;
height: 100%;
}
.menu a {
margin-left: 20px;
color: #808080;
display: block;
font-size: 12px;
font-weight: 700;
line-height: 40px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.menu a:hover {
color: #ffffff;
}
.menu a:active {
color: #ffffff;
}
.menu a > i {
float: left;
display: inline-block;
vertical-align: middle;
text-align: left;
width: 25px;
font-size: 14px;
line-height: 40px;
margin: 25px 2px;
}
.menu-close {
cursor: pointer;
display: block;
position: absolute;
font-size: 14px;
color: #808080;
width: 40px;
height: 40px;
line-height: 40px;
top: 20px;
right: 5px;
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
.menu-close:hover {
color: #ffffff;
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
/* Push the body after clicking the menu button */
.body-push {
overflow-x: hidden;
position: relative;
left: 0;
}
.body-push-toright {
left: 200px;
}
.body-push-toleft {
left: -200px;
}
.menu,
.body-push {
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
#menuToggle {
position: absolute;
top: 20px;
left: 0;
z-index: 11;
display: block;
text-align: center;
font-size: 14px;
color: #ffffff;
width: 40px;
height: 40px;
line-height: 40px;
cursor: pointer;
background: rgba(0,0,0,0.25);
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
#menuToggle:hover {
color: #ffffff;
background: rgba(0,0,0,0.2);
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
UPDATE: I finally found a way to get it working.
HTML:
<!-- Menu -->
<nav class="menu" id="theMenu">
<div class="menu-wrap">
<h1 class="logo">Menu</h1>
<i class="icon-remove menu-close"></i>
Home
Services
Process
Portfolio
About
Contact
<i class="icon-facebook"></i>
<i class="icon-twitter"></i>
<i class="icon-dribbble"></i>
<i class="icon-envelope"></i>
</div>
<!-- Menu button -->
<div id="menuToggle"><i class="icon-reorder"></i></div>
</nav>
CSS:
.menu {
position: fixed;
right: -200px;
width: 260px;
height: 100%;
top: 0;
z-index: 10;
text-align: left;
}
.menu.menu-open {
right: 0px;
}
.menu-wrap {
position: absolute;
top: 0;
left: 60px;
background: #1a1a1a;
width: 200px;
height: 100%;
}
.menu h1.logo a {
font-family: 'Raleway', Helvetica, Arial, sans-serif;
font-size: 16px;
font-weight: 800;
letter-spacing: 0.15em;
line-height: 40px;
text-transform: uppercase;
color: #ffffff;
margin-top: 20px;
}
.menu h1.logo a:hover {
color: #f85c37;
}
.menu img.logo {
margin: 20px 0;
max-width: 160px;
}
.menu a {
margin-left: 20px;
color: #808080;
display: block;
font-size: 12px;
font-weight: 700;
line-height: 40px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.menu a:hover {
color: #ffffff;
}
.menu a:active {
color: #ffffff;
}
.menu a > i {
float: left;
display: inline-block;
vertical-align: middle;
text-align: left;
width: 25px;
font-size: 14px;
line-height: 40px;
margin: 25px 2px;
}
.menu-close {
cursor: pointer;
display: block;
position: absolute;
font-size: 14px;
color: #808080;
width: 40px;
height: 40px;
line-height: 40px;
top: 20px;
right: 5px;
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
.menu-close:hover {
color: #ffffff;
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
/* Push the body after clicking the menu button */
.body-push {
overflow-x: hidden;
position: relative;
left: 0;
}
.body-push-toright {
left: 200px;
}
.body-push-toleft {
left: -200px;
}
.menu,
.body-push {
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
#menuToggle {
position: absolute;
top: 20px;
left: 0;
z-index: 11;
display: block;
text-align: center;
font-size: 14px;
color: #ffffff;
width: 40px;
height: 40px;
line-height: 40px;
cursor: pointer;
background: rgba(0,0,0,0.25);
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
#menuToggle:hover {
color: #ffffff;
background: rgba(0,0,0,0.2);
-webkit-transition: all .1s ease-in-out;
-moz-transition: all .1s ease-in-out;
-ms-transition: all .1s ease-in-out;
-o-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
Javascript:
// Menu settings
$('#menuToggle, .menu-close').on('click', function(){
$('#menuToggle').toggleClass('active');
$('body').toggleClass('body-push-toleft');
$('#theMenu').toggleClass('menu-open');
});
// Scrollable menu on small devices
$(window).bind("load resize", function(){
if($(window).height() < 400){
$(".menu").css("overflow-y","scroll");
}
else {
$(".menu").css("overflow-y","hidden");
}
});
I would recommend reading this: http://www.sitepoint.com/css3-sliding-menu/
If the article is TL;DR then use
/* Revealing 3D Menu CSS */
body
{
font-family: sans-serif;
font-size: 100%;
padding: 0;
margin: 0;
color: #333;
background-color: #221;
}
/* main page */
article
{
position: fixed;
width: 70%;
left: 0;
top: 0;
right: 0;
bottom: 0;
padding: 30px 15%;
background-color: #fff;
overflow: auto;
z-index: 0;
-webkit-transform-origin: 0 50%;
-moz-transform-origin: 0 50%;
-ms-transform-origin: 0 50%;
-o-transform-origin: 0 50%;
transform-origin: 0 50%;
}
article:after
{
position: absolute;
content: ' ';
left: 100%;
top: 0;
right: 0;
bottom: 0;
background-image: -webkit-linear-gradient(right, rgba(0,0,0,0.2) 0%, transparent 100%);
background-image: -moz-linear-gradient(right, rgba(0,0,0,0.2) 0%, transparent 100%);
background-image: -ms-linear-gradient(right, rgba(0,0,0,0.2) 0%, transparent 100%);
background-image: -o-linear-gradient(right, rgba(0,0,0,0.2) 0%, transparent 100%);
background-image: linear-gradient(right, rgba(0,0,0,0.2) 0%, transparent 100%);
pointer-events: none;
}
/* navigation */
nav
{
position: fixed;
left: -16em;
top: 0;
bottom: 0;
background-color: #654;
border-right: 50px solid #765;
box-shadow: 4px 0 5px rgba(0,0,0,0.2);
z-index: 1;
cursor: pointer;
}
nav:after
{
position: absolute;
content: ' ';
width: 0;
height: 0;
right: -70px;
top: 50%;
border-width: 15px 10px;
border-style: solid;
border-color: transparent transparent transparent #765;
}
nav ul
{
width: 14em;
list-style-type: none;
margin: 0;
padding: 1em;
}
nav a:link, nav a:visited
{
display: block;
width: 100%;
font-weight: bold;
line-height: 2.5em;
text-indent: 10px;
text-decoration: none;
color: #ffc;
border-radius: 4px;
outline: 0 none;
}
nav a:hover, nav a:focus
{
color: #fff;
background-color: #543;
text-shadow: 0 0 4px #fff;
box-shadow: inset 0 2px 2px rgba(0,0,0,0.2);
}
/* hovering */
article, article:after, nav, nav *
{
-webkit-transition: all 600ms ease;
-moz-transition: all 600ms ease;
-ms-transition: all 600ms ease;
-o-transition: all 600ms ease;
transition: all 600ms ease;
}
nav:hover
{
left: 0;
}
nav:hover ~ article
{
-webkit-transform: translateX(16em) perspective(600px) rotateY(10deg);
-moz-transform: translateX(16em) perspective(600px) rotateY(10deg);
-ms-transform: translateX(16em) perspective(600px) rotateY(10deg);
-o-transform: translateX(16em) perspective(600px) rotateY(10deg);
transform: translateX(16em) perspective(600px) rotateY(10deg);
}
nav:hover ~ article:after
{
left: 60%;
}
This can be used to create a 3d sliding menu as seen here