I have an animated burger menu that is on the left of the screen. When you click on the burger the menu expands to the right. However I want the menu to be on the right hand side. When I use float right the menu moves to the top right however it is still expanding to the right so it moves off the screen, is there any way I could flip the menu so it is expanding to the left. If anyone doesn't know what I am talking about this is the code I am using https://codepen.io/woodwoerk/pen/BoEGYZ
.menu {
margin: 0 20px 0 0;
padding-left: 1.25em;
cursor: pointer;
position: relative;
width: 30px;
height: 50px;
text-align: right;
float: right;
}
expand {
box-shadow: rgba(0, 0, 0, 0.1) -2.5px 5px 7.5px, rgba(0, 0, 0, 0.1) 2.5px 5px 7.5px;
width: 200px;
height: 50px;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.menu-top-expand {
top: 50px;
background: #FFF8E1;
-webkit-transition: all 0.5s 0.2s, left 0.1s;
transition: all 0.5s 0.2s, left 0.1s;
}
.menu-middle-expand {
top: 100px;
background: #FFECB3;
-webkit-transition: all 0.5s 0.1s, left 0.1s;
transition: all 0.5s 0.1s, left 0.1s;
}
.menu-bottom2-expand {
top: 200px;
background: #FFECB3;
-webkit-transition: all 0.5s 0.1s, left 0.1s;
transition: all 0.5s 0.1s, left 0.1s;
}
.menu-bottom-expand {
top: 150px;
height: 100px;
background: #FFE082;
-webkit-transition: all 0.5s, left 0.1s;
transition: all 0.5s, left 0.1s;
}
.menu-text-expand{
color: #000000;
opacity: 0.8;
padding: 10px;
font-size: 1.3em;
-webkit-transition: all 0.2s 0.7s, font-size 0.1s;
transition: all 0.2s 0.7s, font-size 0.1s;
}
Thanks in advance
So after you float: right; to .menu, on .menu-global change left to left: auto and add right: 0;
Same changes as #pavger, just adding : on .menu-global:hover, change left: 10px; to right 10px; to get the right effect :
https://codepen.io/anon/pen/jZrVvg
.menu-global:hover {
right: 10px;
-webkit-transition: all 0.2s;
transition: all 0.2s;
}
#pavger sorry, i don't have enough reputation to comment your post :(
Related
I have tabbed navigation with two tabs. When the screen width is reduced to a small mobile (below 415px), the tabs go onto two different rows instead of wrapping the tab text so that both tabs stay on one line. I'd like some help in wrapping the tab text please. I have tried setting a max-width, changing some of the display options, and adding flex-wrap: wrap; to no avail.
JSFiddle: https://jsfiddle.net/Clubba/hqud9L46/2/
HTML
<div class="tab-wrap">
<input type="radio" id="tab1" name="tabGroup1" class="tab" checked>
<label for="tab1"><span style="font-family:Montserrat,sans serif;">Tab 1 title</span></label>
<input type="radio" id="tab2" name="tabGroup1" class="tab">
<label for="tab2"><span style="font-family:Montserrat,sans serif;">Tab 2 title</span></label>
<div class="tab__content"><br />
Tab 1 content
</div>
<div class="tab__content"><br />
Tab 2 content
</div>
</div>
CSS
.tab-wrap {
-webkit-transition: 0.3s box-shadow ease;
transition: 0.3s box-shadow ease;
border-radius: 15px 15px 0 0;
max-width: 90%;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
position: relative;
list-style: none;
background-color: #fff;
margin: 40px 0;
box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.02), 0 1px 10px rgba(0, 0, 0, 0.1);
}
.tab {
display: none;
}
.tab:checked:nth-of-type(1) ~ .tab__content:nth-of-type(1) {
opacity: 1;
-webkit-transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
transition: 0.5s opacity ease-in, 0.8s transform ease;
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
position: relative;
top: 0;
z-index: 1;
-webkit-transform: translateY(0px);
transform: translateY(0px);
text-shadow: 0 0 0;
}
.tab:checked:nth-of-type(2) ~ .tab__content:nth-of-type(2) {
opacity: 1;
-webkit-transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
transition: 0.5s opacity ease-in, 0.8s transform ease;
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
position: relative;
top: 0;
z-index: 1;
-webkit-transform: translateY(0px);
transform: translateY(0px);
text-shadow: 0 0 0;
}
.tab:first-of-type:not(:last-of-type) + label {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.tab:not(:first-of-type):not(:last-of-type) + label {
border-radius: 0;
}
.tab:last-of-type:not(:first-of-type) + label {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.tab:checked + label {
background-color: #fff;
box-shadow: 0 -1px 0 #fff inset;
cursor: default;
}
.tab:checked + label:hover {
box-shadow: 0 -1px 0 #fff inset;
background-color: #fff;
}
.tab:not(:checked) + label {
color:#fff;
}
.tab + label {
box-shadow: 0 -1px 0 #eee inset;
border-radius: 15px 15px 0 0;
cursor: pointer;
display: block;
text-decoration: none;
color: #333;
-webkit-box-flex: 3;
-ms-flex-positive: 3;
flex-grow: 3;
text-align: center;
background-color: #34404d;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
text-align: center;
-webkit-transition: 0.3s background-color ease, 0.3s box-shadow ease;
transition: 0.3s background-color ease, 0.3s box-shadow ease;
height: 80px;
box-sizing: border-box;
padding-top: 25px;
padding-bottom: 5px;
flex-wrap: wrap;
max-width: 90%;
}
.tab + label:hover {
background-color: #576c82;
box-shadow: 0 1px 0 #f4f4f4 inset;
}
.tab__content {
padding: 10px 25px;
background-color: transparent;
position: absolute;
width: 100%;
z-index: -1;
opacity: 0;
left: 0;
-webkit-transform: translateY(-3px);
transform: translateY(-3px);
border-radius: 6px;
}
Making flex-wrap:nowrap; and adding min-width: 50% to tab class will make sure your navigation tabs don't go into different rows. But doing this will create problems for your tab contents. And you cannot even move them to different elements because then your checked pseudo element won't work( they works only with descendants or siblings). there can be certainly be better solution which i don't know of but what I realized is you can do following
since Your problem boils down to layout with setting layout you can use grid instead of flex, since you need 2D layout to prevent navigation tabs from wrapping.
you can make use of position and make tab contents position absolutely relative to body or navigation tabs.
I am trying to have a corner button display new content on hover using the following setup:
<div class="panel panel-default1">
<div class="panel-body">
<div class='amg-corner-button_wrap'>
<div class="overlay"></div>
<div class="overlay-content">
<h2>Image Ink Logo</h2>
<p>Logo for a screen printing company. They wanted a detachable/recognizable brand that didn't need the name of the company.</p>
</div>
</div> <!-- wrap -->
</div> <!-- panel body -->
</div> <!-- panel default -->
CSS:
.panel-default1 {
padding-top: 10px;
border-radius: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.10);
height: 400px;
width: 100%;
overflow: hidden;
margin: 0 auto;
position: relative;
}
.amg-corner-button_wrap {
display: block;
position: absolute;
bottom: 0;
right: 0;
width: 40px;
height: 40px;
}
.amg-corner-button_wrap .overlay {
border-bottom: 40px solid #e8c63d;
border-left: 40px solid transparent;
bottom: 0;
height: 0;
opacity: .95;
position: absolute;
right: 0;
text-indent: -9999px;
-moz-transition: all 0.5s ease-out;
-o-transition: all 0.5s ease-out;
-webkit-transition: all 0.5s ease-out;
transition: all 0.5s ease-out;
width: 0;
}
.amg-corner-button_wrap:hover .overlay {
border-bottom: 800px solid #e8c63d;
border-left: 800px solid transparent;
-moz-transition: all 0.5s ease-out;
-o-transition: all 0.5s ease-out;
-webkit-transition: all 0.5s ease-out;
transition: all 0.5s ease-out;
}
.amg-corner-button_wrap .overlay-content {
bottom: 0;
color: #333;
left: 0;
opacity: 0;
padding: 30px;
position: absolute;
right: 0;
top: 0;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
-webkit-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.amg-corner-button_wrap .overlay-content h2 {
border-bottom: 1px solid #333;
padding: 0 0 12px;
}
.amg-corner-button_wrap:hover .overlay-content {
opacity: 1;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
-webkit-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
-moz-transition-delay: 0.3s;
-o-transition-delay: 0.3s;
-webkit-transition-delay: 0.3s;
transition-delay: 0.3s;
}
Here is fiddle : https://jsfiddle.net/ar3jkuvq/
The hover deployment works well but the .overlay-content text does not show up if .amg-corner-button_wrap uses position: absolute. However I need it to keep the hover on the wrap only.
How can I keep the hover effect on the wrap only and show the text content at the same time?
You can use CSS3 transform property to scale the overlay instead of using a border, and then use a General sibbling combinator [w3] selector ~ to select the .overlay-content element that is preceded by a .amg-corner-button_wrap:hover.
Working fiddle
add this class in your css
.amg-corner-button_wrap{
width:100%;
height:100%;
}
I believe you can make use of the pointer-events attribute here.
Remove position: absolute; from .amg-corner-button_wrap
Add pointer-events: none; to .panel-default1
Add pointer-events: all; to .amg-corner-button_wrap .overlay
Working JSFiddle
I've got a pop out image in CSS, and i've implemented it into my html. I would just like to know how I can add text that is vertically aligned with the centre of the image (before you hover it)
EDIT: Sorry guys, I should have clarified that I want the text right of the image, with the centre of the text and centre of the image vertically aligned
I've managed to place it in the correct place using absolute position. However, what would I do if i have multiple icons using the same class?
p.social-popout {
height: 48px;
width: 48px;
margin: 10px;
float: left;
-webkit-transition: all ease 0.5s;
-moz-transition: all ease 0.5s;
-o-transition: all ease 0.5s;
-ms-transition: all ease 0.5s;
transition: all ease 0.5s;
float: left;
}
p.social-popout img {
border-radius: 50%;
margin: 8px;
width: 100%;
box-shadow: 0px 0px 4px 1px rgba(0,0,0,0.8);
-webkit-transition: all ease 0.5s;
-moz-transition: all ease 0.5s;
-o-transition: all ease 0.5s;
-ms-transition: all ease 0.5s;
transition: all ease 0.5s;
float: left;
}
p.social-popout img:hover {
margin: 0px;
box-shadow: 6px 6px 4px 4px rgba(0,0,0,0.3);
float: left;
}
<p class="social-popout"><img src="http://bradsknutson.com/wp-content/themes/bradsknutson/images/facebook-48circle.png" /></p>
try it
display: flex;
justify-content: center; /* align horizontal */
align-items: center; /* align vertical */
or use
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
You can make your p is relative, and make text content abosolute.
Hope it will help you
p.social-popout {
position: relative;
height: 48px;
width: 48px;
margin: 10px;
float: left;
-webkit-transition: all ease 0.5s;
-moz-transition: all ease 0.5s;
-o-transition: all ease 0.5s;
-ms-transition: all ease 0.5s;
transition: all ease 0.5s;
float: left;
}
p.social-popout img {
border-radius: 50%;
margin: 8px;
width: 100%;
box-shadow: 0px 0px 4px 1px rgba(0,0,0,0.8);
-webkit-transition: all ease 0.5s;
-moz-transition: all ease 0.5s;
-o-transition: all ease 0.5s;
-ms-transition: all ease 0.5s;
transition: all ease 0.5s;
float: left;
}
p.social-popout img:hover {
margin: 0px;
box-shadow: 6px 6px 4px 4px rgba(0,0,0,0.3);
float: left;
}
p.social-popout span{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%);
line-height: 0;
color: #f70000;
font-size: 20px;
font-weight: bold;
}
<p class="social-popout"><img src="http://bradsknutson.com/wp-content/themes/bradsknutson/images/facebook-48circle.png" /><span>text</span></p>
I am trying to make a hover open div with css. I created it but i have one question about hover position left and right.
First of all sorry for my english.
I created this DEMO from Codepen.
My question is: If you check my demo page you see information and location icon. When you hover over information or location icon then you see bubble div. in the upper left corner of the nice parts. but if you hover over information or location on the right side then you see bubble carry out.
I don't want to carry out bubble. I want to make a bubble stay in main div inside. What should i do for this ? Anyone can help me here ?
Here is my HTML code:
<div class="ssss">
<div class="s_u_a">
<div class="user_p_c_p">
<img src="1.jpg">
</div>
<div class="user_p_p_p">
<img src="2.jpg">
</div>
<div class="u_l_inf">
<div class="u_l_"><div class="uynott">test</div></div>
<div class="u_inf_"><div class="uynott2">test</div></div>
</div>
<div class="u_p_n_">test</div>
<div class="u_p_n_s">test</div>
</div>
</div>
in this html code main div is .sss
and this is my css code for bubble:
.u_l_:hover .uynott {
position:relative;
opacity:1;
visibility:visible;
transition: opacity .5s linear .5s;
-webkit-transition: opacity .5s linear .5s;
-moz-transition: opacity .5s linear .5s;
-ms-transition: opacity .5s linear .5s;
}
.uynott
{
font-family: 'lucida grande',tahoma,verdana,arial,sans-serif;
font-size:12px;
position: relative;
width: 295px;
height: auto;
padding: 10px;
background-color:#5890ff;
color:#fff;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
border: #5890ff solid 1px;
visibility:hidden;
line-height: 21px;
margin-left: -25px;
opacity:0;
margin-top:25px;
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.7s ease-in-out;
-o-transition: all 0.7s ease-in-out;
-ms-transition: all 0.7s ease-in-out;
transition: all 0.7s ease-in-out;
z-index:5;
}
.uynott:after
{
content: '';
position: absolute;
border-style: solid;
border-width: 0 8px 8px;
border-color: #5890ff transparent;
display: block;
width: 0;
z-index: 1;
top: -8px;
left: 20px;
}
.uynott:before
{
content: '';
position: absolute;
border-style: solid;
border-width: 0 8px 8px;
border-color: #5890ff transparent;
display: block;
width: 0;
z-index: 0;
top: -9px;
left: 20px;
}
.u_inf_:hover .uynott2 {
position:relative;
opacity:1;
visibility:visible;
transition: opacity .5s linear .5s;
-webkit-transition: opacity .5s linear .5s;
-moz-transition: opacity .5s linear .5s;
-ms-transition: opacity .5s linear .5s;
}
.uynott2
{
font-family: 'lucida grande',tahoma,verdana,arial,sans-serif;
font-size:12px;
position: relative;
width: 295px;
height: auto;
padding: 10px;
background-color:#5890ff;
color:#fff;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
border: #5890ff solid 1px;
visibility:hidden;
line-height: 21px;
margin-left: -115px;
opacity:0;
margin-top:25px;
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.7s ease-in-out;
-o-transition: all 0.7s ease-in-out;
-ms-transition: all 0.7s ease-in-out;
transition: all 0.7s ease-in-out;
z-index:5;
}
.uynott2:after
{
content: '';
position: absolute;
border-style: solid;
border-width: 0 8px 8px;
border-color: #5890ff transparent;
display: block;
width: 0;
z-index: 1;
top: -8px;
left: 115px;
}
.uynott2:before
{
content: '';
position: absolute;
border-style: solid;
border-width: 0 8px 8px;
border-color: #5890ff transparent;
display: block;
width: 0;
z-index: 0;
top: -9px;
left: 115px;
}
TBH... you just have to make another class for your divs at the right and move the div hidden before hover.
here you have your code working: http://codepen.io/anon/pen/bDrwk
code
Just have a look at the changes I made and you will easily see what you had to do. won't copy all the code as it will be as long as yours (even longer) and a bit confusing I move also the little arrow of your bubble.
Just remove width:295px from the class .uynott2 and check the output!!
The arrows before the title are displayed using a :before. The problem only occur on Internet Explorer.
// edit : Mistake there, my styling is on p a.
Maybe is it the issue ?
So, here's the code:
.special-title {
font-size: 24px;
color: #a4a19e;
line-height: 1.2;
position: relative;
padding: 8px 0 8px 38px;
border-top: 1px solid #e2dbcf;
border-bottom: 1px solid #e2dbcf;
margin-top: 49px;
margin-bottom: 25px; }
.special-title:before {
content: url('../img/general-title-decoration.svg?1369571463');
position: absolute;
width: 28px;
left: 0;
top: 23px;
margin-top: -13px; }
and for the button:
.btn-call-to-action a {
background: #8e8287;
color: #f5f3e2;
padding: 2px 60px 2px 10px;
height: 35px;
line-height: 40px;
margin-top: 6px;
display: inline-block;
position: relative;
border-radius: 2px;
height: 40px;
white-space: nowrap;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out; }
.btn-call-to-action a:hover:after {
-webkit-transform: translatex(6px);
-moz-transform: translatex(6px);
-o-transform: translatex(6px);
-ms-transform: translatex(6px);
transform: translatex(6px); }
.btn-call-to-action a:hover {
background: #6f6469;
border-bottom: none; }
.btn-call-to-action a:after {
content: url('../img/general-white-arrow.svg?1369574895');
position: absolute;
width: 35px;
right: 15px;
top: 0px;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out; }
and here's the live site: http://aurelieremia.be/tfa/
In .special-title:before, since you're using absolute positioning, remove
margin-top:-13px;
and just use
top:10px;
instead. Then, declare a height as well as a width.
see http://jsfiddle.net/6TdB6/