CSS Fixed sidebar in the right - css

I'm trying to make a two column responsive layout using bootstrap.
In the left column I want to place my content with the width of 100%/2, and in the right, a fixed sidebar with the width of 100%/3.
this is the css I used to my sidebar but in the fiddle I attached the sidebar is in left side and I want it to be in right side.
#sidebar-wrapper {
z-index: 1000;
position: fixed;
left: 250px;
width: 0;
height: 100%;
margin-left: -250px;
overflow-y: auto;
background: #000;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
Fiddle :
https://jsfiddle.net/une5nhf4/
How can I modify this to correspond to my needs ?

I modified your CSS:
#wrapper {
padding-left: 0;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#wrapper.toggled {
padding-right: 250px;
}
#sidebar-wrapper {
z-index: 1000;
position: fixed;
right: 250px;
width: 0;
height: 100%;
margin-right: -250px;
overflow-y: auto;
background: #000;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#wrapper.toggled #sidebar-wrapper {
width: 250px;
}
#page-content-wrapper {
width: 100%;
position: absolute;
padding: 15px;
}
#wrapper.toggled #page-content-wrapper {
position: absolute;
margin-right: -250px;
}
/* Sidebar Styles */
.sidebar-nav {
position: absolute;
top: 0;
width: 250px;
margin: 0;
padding: 0;
list-style: none;
}
.sidebar-nav li {
text-indent: 20px;
line-height: 40px;
}
.sidebar-nav li a {
display: block;
text-decoration: none;
color: #999999;
}
.sidebar-nav li a:hover {
text-decoration: none;
color: #fff;
background: rgba(255,255,255,0.2);
}
.sidebar-nav li a:active,
.sidebar-nav li a:focus {
text-decoration: none;
}
.sidebar-nav > .sidebar-brand {
height: 65px;
font-size: 18px;
line-height: 60px;
}
.sidebar-nav > .sidebar-brand a {
color: #999999;
}
.sidebar-nav > .sidebar-brand a:hover {
color: #fff;
background: none;
}
#media(min-width:768px) {
#wrapper {
padding-right: 250px;
}
#wrapper.toggled {
padding-right: 0;
}
#sidebar-wrapper {
width: 250px;
}
#wrapper.toggled #sidebar-wrapper {
width: 0;
}
#page-content-wrapper {
padding: 20px;
position: relative;
}
#wrapper.toggled #page-content-wrapper {
position: relative;
margin-right: 0;
}
}
DEMO

Related

CSS selector error - Submenu not showing on Hover

Been battling with getting my Submenu to show on hover, it works but as soon as I slide off the parent element '.dropdown-toggle', the Submenu disappears.
Been trying for hours to fix this, look at the code below and see if you can solve the issue please.
Much appreciated
.dropdown-menu {
position: absolute;
top: 40px;
border: none;
padding: 0;
border-radius: 0;
width: 200px;
background: #e8e8e8;
visibility:hidden;
opacity:0;
filter:alpha(opacity=0);
-webkit-transition:700ms ease;
-moz-transition:700ms ease;
-o-transition:700ms ease;
transition:700ms ease;
}
.dropdown-toggle:hover + .dropdown-menu, .dropdown-menu {
display: block;
visibility:visible;
opacity:1;
filter:alpha(opacity=100);
}
Just a few changes can solve this:
dropdown-toggle changed to dropdown-menu.(Parent changed)
.dropdown-menu {
position: absolute;
top: 33px; /* reduced the gap so that it wont dissapear while hovering on submenu*/
border: none;
padding: 0;
border-radius: 0;
width: 200px;
background: #e8e8e8;
visibility:hidden;
opacity:0;
filter:alpha(opacity=0);
-webkit-transition:700ms ease;
-moz-transition:700ms ease;
-o-transition:700ms ease;
transition:700ms ease;
}
.dropdown:hover .dropdown-menu {
display: block;
visibility:visible;
opacity:1;
filter:alpha(opacity=100);
}
You may try this CSS:
.dropdown-menu {
position: absolute;
border: none;
padding: 0;
border-radius: 0;
width: 200px;
background: #e8e8e8;
visibility: hidden;
opacity: 0;
filter: alpha(opacity=0);
-webkit-transition: 700ms ease;
-moz-transition: 700ms ease;
-o-transition: 700ms ease;
transition: 700ms ease;
margin-top: -5px;
padding-top: 5px;
}
.dropdown-toggle {
position: relative;
display: inline-block;
}
.dropdown-toggle:hover .dropdown-menu {
display: block;
visibility: visible;
opacity: 1;
filter: alpha(opacity=100);
}
HTML:
<div class="dropdown-toggle">
<a>Hover me</a>
<ul class="dropdown-menu">
<li>A</li>
<li>B</li>
<li>C</li>
</ul>
</div>
Demo: http://jsfiddle.net/lotusgodkk/GCu2D/2204/
Thanks for your all your answers. This was the working solution below.
.dropdown-menu {
position: absolute;
top: 40px;
border: none;
padding: 0;
border-radius: 0;
width: 200px;
background: #e8e8e8;
visibility:hidden;
opacity:0;
filter:alpha(opacity=0);
-webkit-transition:700ms ease;
-moz-transition:700ms ease;
-o-transition:700ms ease;
transition:700ms ease;
}
.dropdown:hover .dropdown-menu, .dropdown-menu {
display: block;
visibility:visible;
opacity:1;
filter:alpha(opacity=100);
}

How I can make Pure CSS3 Smooth Drop-Down Menu in wordpress?

I am making a bootstrap wordpress theme and I have a problem about adding pure smooth drop-down menu effect for primary menu like this example such as it does not seem to work properly after clicked "M logo" to open drop-down menu. You can check out my theme on this link for more detail
Here are my CSS classes at the moment:
.navbar-nav>li>.dropdown-menu {
margin: -1px 0 0 45%;
border-top-right-radius: 0;
border-top-left-radius: 0;
}
.dropdown-menu {
/* background: url(img/submenu.png) no-repeat scroll right/ 91% 100%; */
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 153px;
padding: 1px 0;
margin: 2px 0 0 0;
list-style: none;
font-size: 14px;
text-align: center;
background-color: #5c4d4a;
border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,0.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,0.175);
box-shadow: 0 6px 12px rgba(0,0,0,0.175);
background-clip: padding-box;
}
.dropdown-menu li a {
display: block;
background: url(img/submenu.png) no-repeat scroll right/ 104% 108%;
padding: 10px 20px;
clear: both;
font-weight: normal;
line-height: 1.428571;
color: #fff;
white-space: nowrap;
}
.dropdown-menu li a:hover,
.dropdown-menu li a:focus {
background: url(img/submenu.png) no-repeat scroll right/ 104% 108%;
color: #ccc;
text-decoration: none;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;
}
.dropdown-menu ul {
list-style: none;
}
The salient features required are:
.dropdown-menu {
opacity: 0;
position: absolute;
top: 35px;
visibility: hidden;
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;
}
nav li:hover .dropdown-menu {
opacity: 1;
top: 50px;
visibility: visible;
}
The float:left is a furfy, it is over-ridden by position:absolute;

Search tool bar hide effect

I'm working on my search toolbar for my website. Everything is running ok, except for the hide effect of the toolbar that has a weird behaviour. The transition works fine to display the writting bar, when I clock again in the search icon its suppose to hide the full bar, but instead hides only about half. If I click outside the search toolbar the bar hides correctly. Here is my code: Jsfiddle. And the relevant code:
#input {
position: absolute;
top: 0;
right: 30px;
width: 200px;
height: 30px;
z-index: 5;
overflow: hidden;}
#input input {
display: block;
position: absolute;
top: 0;
right: -200px;
width: 200px;
height: 100%;
margin: 0;
padding: 0 10px;
border: none;
background-color: #ededed;
color: #000;
font-size: 12px;
-webkit-backface-visibility: none;
-moz-backface-visibility: none;
-ms-backface-visibility: none;
backface-visibility: none;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-transition: right 0;
-moz-transition: right 0;
-ms-transition: right 0;
-o-transition: right 0;
transition: right 0;}
#input input:focus {
outline: none;}
#input.focus {
z-index: 20;}
#input.focus input {
right: 0;
-webkit-transition: right 0.3s;
-moz-transition: right 0.3s;
-ms-transition: right 0.3s;
-o-transition: right 0.3s;
transition: right 0.3s;}
Thanks in advance!
Its seems the reason input box not hidding completely due to padding given for input element
.input input { padding: 0 10px;
The actual width is calculated by browser for input box is
width:200px + padding-left:10px + padding-right:10px = Actual width goes to 220px;
Solution for this is by adding
.input input { box-sizing:border-box;
property to input element class
Sample code can be seen here
.input {
position: absolute;
top: 0;
right: 30px;
width: 200px;
height: 30px;
line-height: 30px;
z-index: 5;
overflow: hidden;
border:1px solid #ccc;
background-color:#fff;
}
.input input {
box-sizing:border-box;
display: block;
position: absolute;
top: 0;
right: -200px;
width: 200px;
height: 100%;
margin: 0;
padding: 0 10px;
border: none;
background-color: #fff;
color: #000;
font-size: 12px;
-webkit-backface-visibility: none;
-moz-backface-visibility: none;
-ms-backface-visibility: none;
backface-visibility: none;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-transition: right -200px;
-moz-transition: right -200px;
-ms-transition: right -200px;
-o-transition: right -200px;
transition: right -200px;
}
.input input:focus { outline: none; }
.input.focus { z-index: 20; }
.input:hover input{
right:0px;
-webkit-transition: right 0px 0.3s;
-moz-transition: right 0.3s;
-ms-transition: right 0.3s;
-o-transition: right 0.3s;
transition: right 0px 0.3s;
}
.input.focus input {
right:0px;
-webkit-transition: right 0px 0.3s;
-moz-transition: right 0.3s;
-ms-transition: right 0.3s;
-o-transition: right 0.3s;
transition: right 0px 0.3s;
}
body { font:13px 'arial'; }
https://jsfiddle.net/ShirishDhotre/9gqa2bum/
I added hover effect for demo you can remove class
.input:hover input{

How to apply css hover on multiple elements

Hi I'm working on simple hover with only css. I'm curious if it's possible to apply one hover to multiple html elements. Here is my example:
.work-cart{
z-index: 4;
position: absolute;
width: 250px;
height: 300px;
left: 200px;
opacity: 0;
background: #fff;
padding-right: 45px;
padding-left: 45px;
padding-bottom: 30px;
padding-top: 150px;
text-align: right;
bottom: 0;
-webkit-transition: all 0.8s ease;
-moz-transition: all 0.8s ease;
-o-transition: all: 0.8s ease;
transitions: all 0.8s ease;
}
.f:hover > .work-cart{
left: 220px;
opacity: 1;
}
.g:hover > .work-cart{
left: 220px;
opacity: 1;
}
.h:hover > .work-cart{
left: 220px;
opacity: 1;
}
Is there any option to asign the hover for .f .g and .h at once ?
You can try
.f:hover > .work-cart, .g:hover > .work-cart, .h:hover > .work-cart{
left: 220px;
opacity: 1;
}

CSS3 Browser compatibility

The CSS3 transition effect on this page works perfectly well on every other browser except IE. It also adds a border to the top and to the left of the thumbnails. I have tried making the borders of all the elements 0 but it still didn't help. The css is as shown below.
.slide-up-boxes .showbox a {
display: block;
margin: 0 0 20px;
height: 157px;
overflow: hidden;
width: 315px;
float: left;
border:none;
padding: 0px;
background: transparent;
}
.slide-up-boxes .showbox img {
color: #333;
text-align: center;
margin-right: 15px;
width: 315px;
float: left;
height: 157px;
font: italic 18px/65px Georgia, Serif; /* Vertically center text by making line height equal to height */
zoom: 1;
filter: alpha(opacity=45);
opacity: 0.5;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
}
.showbox a:hover img {
margin-top: -155px;
opacity: 0;
height: 157px;
width: 315px;
}
.showbox object {
color: white;
background: #393838;
font: 12px/15px Georgia, Serif;
opacity: 0;
-webkit-transform: rotate(6deg);
-webkit-transition: all 0.4s linear;
-moz-transform: rotate(6deg);
-moz-transition: all 0.4s linear;
-o-transform: rotate(6deg);
-o-transition: all 0.4s linear;
width: 314px;
float: left;
height: 154px;
border: none;
padding: 0px;
margin: 0px 15px 0px 0px;
}
.slide-up-boxes .showbox a:hover object {
opacity: 1;
width: 314px;
border: none;
-webkit-transform: rotate(0);
-moz-transform: rotate(0);
-o-transform: rotate(0);
zoom: 1;
}
.slide-up-boxes .showbox#show1 object {
background: url(images/huethumb.jpg) ;
padding-top: 110px; zoom: 1;
border: none;
}
.slide-up-boxes .showbox#show2 object {
background: url(images/pizzathumb.jpg) ;
padding-top: 110px; zoom: 1;
border: none;
}
.slide-up-boxes .showbox#show3 object {
background: url(images/rickolthumb.jpg) ;
padding-top: 110px;
border: none;
}
.slide-up-boxes .showbox#show4 object {
background:url(images/bernie-thumber.jpg) ;
padding-top: 110px; zoom: 1;
background-repeat: no-repeat;
border: none;
}
.slide-up-boxes .showbox#show5 object {
background: url(images/nollythumb.png) ;
padding-top: 110px; zoom: 1;
border: none;
}
.slide-up-boxes .showbox#show6 object {
background:url(images/photothumg.jpg) ;
padding-top: 110px; zoom: 1;
border: none;
}
.slide-up-boxes .showbox#show7 object {
background:url(images/tradersthumb.png) ;
padding-top: 110px; zoom: 1;
border: none;
}
.slide-up-boxes .showbox#show8 object {
background:url(images/wpbathumb.jpg);
padding-top: 110px; zoom: 1;
border: none;
}
.slide-up-boxes .showbox#show9 object {
background:url(images/peterthumb.png);
padding-top: 110px;
zoom: 1;
border: none;
}
Anything you do with -webkit or -moz will not work with IE, they're browser engine specific css styles. ms-transform should work in IE9, but there is no transition style. See this MSDN article on CSS Compatibility and Internet Explorer for more details.

Resources