Buttons under each other in div - html

i created div for some buttons in a kind of sidebar.
But I am not quite sure how do I get them under each other...
My previous solution were 2 divs under eachother but then it was not that could regarding the various display sizes that the buttons are directly under each other...
Any idea?
#sideBar {
position: fixed;
right: -29px;
top: 52vh;
display: inline-grid;
}
#feedbackBtn {
z-index: 1000;
transform: rotate(270deg);
}
#helpBtn {
z-index: 1000;
}
<div id="sideBar">
<Button id="feedbackBtn" onClick={onButtonClick} design="Emphasized">
Feedback
</Button>
<Button id="helpBtn" icon="sys-help" onClick={onButtonClickHelp} design="Default"></Button>
</div>
Image

You could remove the display: inline-grid property from #sideBar, e.g.
#sideBar {
position: fixed;
right: 0px;
top: 52vh;
transform: rotate(270deg);
z-index: 1000;
}
<div id="sideBar">
<button id="feedbackBtn">Feedback</button>
<button id="helpBtn">Help</button>
</div>

I think you only need the sideBar CSS,
Using the attribute below you could make it stick to the right and the button will behave like normal.
Note that
I move the z-index to sidebar because all the button inside of it should be on top of all element right? so you could put it on the sidebar, it doesn't have to be on the child
I move the transform to sidebar so you basically the thing that's rotating is the "container" of the sidebar, you can imagine it as a normal container with two button side by side, and then you rotate it, that's why the button is actually still side by side, not on top of each other
sorry for bad English
#sideBar {
position: fixed;
transform: rotate(270deg);
z-index: 1000;
right:-10px;
top: 52vh;
}
<div id="sideBar">
<Button id="feedbackBtn" onClick={onButtonClick} design="Emphasized">
Feedback
</Button>
<Button id="helpBtn" icon="sys-help" onClick={onButtonClickHelp} design="Default">Help</Button>
</div>

Related

Sticky header z-index lower than overlay z-index but still appears in front

I have a sticky header that needs some z-index to be infront of the page content.
The sticky-header scss is:
.sticky-header {
position: sticky;
top: 0;
padding-top: $spacing;
background-color: $background-color;
z-index: 100;
}
In the content of the page, I have a "modal view" that contains an overlay (modal-container) element that I want to display above the entire page. The modal css looks like:
.modal-container {
z-index: 3000;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.4);
}
.modal-inner {
z-index: 100;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
For some reason, the sticky header is being displayed above the modal overlay, even though it explicitly has a greater z-index value.
The gist of the html structure is:
<div class="sticky-header">...</div>
<div class="page-content">
<div class="modal-container">
<div class="modal-inner">
...content...
</div>
</div>
</div>
Also the sticky-header wraps an angular ng-content if that has anything to do with this issue.
Any help is appreciated!
Usually this is caused by a misunderstanding of the stacking index.
The easiest way to debug it is to manually stick a huge z-index on each parent element of the <div class="modal-container"> until you find out which is the problematic element.
At a guess, you've set position:relative on your <div class="page-content">, and you've given it a z-index of less than 100.

Styling a right menu bar in html and css

I am trying to style a page with a righthand side bar that has a menu. I am using div tags. What I get looks close, but it is not obvious to me how to create the menu div in the right bar that should contain the rotated menu item divs. The image illustrates what I mean. The right bar is transparent such that the main page content below is visible. I want to animate the bar div with Javascript but accomplished that already.
Currently, I have in my css
#menu_list {
top: 0;
left: 0;
padding: 0 0;
text-align: center;
transform-origin: center top;
transform: translateX(-50%) translateY(300%) rotate(-90deg);
}
#menu_list p {
color: #fff;
line-height: 20px;
display: inline-block;
}
#right_bar {
position: fixed;
top: 0;
bottom: 0;
right: 0;
width: 30%;
overflow: auto;
padding: 0;
}
and as html
<div id="bar_wrapper" onclick="toggleMenu()">
<div>
<div id="menu_list">
<p>Info</p>
<p>About</p>
</div>
<div style="width:30%; height:100%; position:fixed; top:0; right:0; bottom:0;">
<h4>
Info
</h4>
</div>
</div>
</div>
but that, like other things that I have tried, does not quite do it.
try this:
jsfiddle.net/TiG3R/bLksqtpw
for rotating navbar you should rotate navbar div not rotate tabs, look at example
use css transform property on your default navbar.
#div_name {
-ms-transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
transform: rotate(-90deg);
}
but I think it won't look responsive.but will look exactly as like u want
enter image description here

Layering with z-index when using a sidenav and modal

z-index is hard, too hard for me right now.
I have a page (#s01) with a fixed sidenav (#s03) and when called a modal (#s02) should cover the whole layer including the sidenav.
Right now the sidenav lays on top of it all despite having a lower z-index than the modal. Altering the z-index (on click) for the sidenav could fix the problem but I'm sure there's a solution without any JavaScript.
This codepen should demonstrate my problem quite well.
What CSS trickery is needed to actually cover the sidenav?
HTML
<div id="s01">
<div id="s02"></div>
</div>
<div id="s03"></div>
CSS
// main
#s01 {
position: relative;
width: 50vw;
height: 100vh;
background: red;
z-index: 1;
}
// reveal
#s02 {
display: none;
position: absolute;
left: 0;
top: 0;
width: 50vw;
height: 100vh;
background: darkblue;
z-index: 3;
}
//sidenav
#s03 {
position: fixed;
top: 50%;
transform: translateY(-50%);
width: 30px;
height: 200px;
background: green;
z-index: 2;
}
Because fixed position element doesn't share the same parent element as the rest elements:
html
<div id="s01">
<div id="s02">Modal!</div>
<button id="mybutton">Click me!</button>
<div id="s03"></div>
</div>
codepen
The z-index property specifies the z-order of an element and its
descendants. When elements overlap, z-order determines which one
covers the other. An element with a larger z-index generally covers an
element with a lower one.
z-index

CSS HTML Angled Div with Overflow hidden on the bottom

please take a look at the image
My Challenge ist the following. The Blue is a div with a background image. The angle should be -6deg. In this div we have transparent png (here the 2 people). The Peoples head are allowed ^^° to get out of the div. but not the legs. And the Image should be animated so that they can "walk" from left to right.
The Problem is for me, that i have no Idea how to archiv the part with heads can "leave" the box but the legs need a "overflow" hidden.
The Blue box should be 100% in width, so rotate -6deg to the div and +6deg to the people doesnt work.
Thank you for my help. If it shouldnt be clear what my problem ist, just ask. Englisch is not first language ^^ Thanks.
Edit: No "Cover" divs. There is a gradient i need to see. the white area above and beneath the blue has to be transparent.
EDit2: I think i got it ^^ Look at this Thanks to SD. !
https://jsfiddle.net/rsr04udj/
You can try some tricks to cover legs and not heads.
Please check this demo I have create small example with text only. You can replace text with images you have.
<div class="wraper">
<div class="whitebar">
<div class="people">PEOPLE</div>
</div>
</div>
Demo
You could use a combination of z-index and pseudo elements for this kind of functionality, meaning that rather than 'hiding the legs', you can sandwich it behind one skewed pseudo and in front of another, creating this 'bottom hidden and top shown' effect:
JsFiddle Demo
Demo Snippet (view snippet in full screen)
.people {
background: url(http://fs2.directupload.net/images/150304/f48hrkmk.png) no-repeat;
background-size: 200px 300px;
height: 300px;
width: 200px;
position: absolute;
bottom: 0;
left: 0;
z-index: 7;
transition: all 6s;
}
.wrap:hover .people {
left: 100%;
}
.wrap {
height: 400px;
width: 100%;
position: relative;
background: lightblue;
overflow: hidden;
}
.wrap:before {
height: 50%;
width: 100%;
content: "";
position: absolute;
top: -20%;
z-index: 6;
left: 0;
-webkit-transform: skewY(-6deg);
-moz-transform: skewY(-6deg);
transform: skewY(-6deg);
background: white;
}
.wrap:after {
height: 50%;
width: 100%;
content: "";
position: absolute;
bottom: -20%;
z-index: 8;
left: 0;
-webkit-transform: skewY(-6deg);
-moz-transform: skewY(-6deg);
transform: skewY(-6deg);
background: white;
}
<div class="wrap">
<div class="people"></div>
</div>
<div class='wrapper'>
<div class='blue-container'>
<div class='people></div>
</div> //remove overflow hidden
<div class='bottom-div></div> // use this div to hide the legs
z-index: 100;
</div> // make this overflow : hidden
I see that you don't have in your code on the .wrapper class position relative.
This is a problem when you use some inner child as absolute It sometimes can be the reason to some problems like this or unwanted scrollbar.
In case there's no relative parent then the absolute will be relative to the window.
(In case of unwanted scrollbar: There's cases when you want the parent to have the overflow hidden and the absolute with scrollbar i saw some people use to put overflow on the html and the body which is bad practice in my opinion but it can cause more issues than benefits, but it's not your case here).
in your case:
.wrapper{
...
position:relative;
}
for the children (in your case whitebar):
.whitebar {
...
height:600px;
}

Horizontally and vertically center div in the middle of page

I am trying to get a page layout like the following
Horizontally and vertically center div in the middle of page with header and footer stuck to top and bottom of page
This works great in all browsers except ie6 and ie7.
Can any one help me how to fix this? I am a server side developer and new to front end. I did some searching but could not found the solution.
Thanks for you help in advance.
Centering vertically with CSS can be a pain. Check out Dead Centre. It requires an extra container 'horizon' to know where the vertical center is, and unfortunately you must know the dimensions of the content you want centered so that you can offset it.
Goes something like this...
body {
margin: 0px
}
#horizon {
text-align: center;
position: absolute;
top: 50%;
left: 0px;
width: 100%;
height: 1px;
overflow: visible;
visibility: visible;
display: block
}
#content {
margin-left: -125px;
position: absolute;
top: -35px;
left: 50%;
width: 250px;
height: 70px;
visibility: visible
}
<body>
<div id="horizon">
<div id="content">
content you want centered
</div>
</div>
</body>
.centered {
background-color: red;
width:50px;
height:50px;
position: fixed;
top: 50%;
left: 50%;
/* bring your own prefixes */
transform: translate(-50%, -50%);
}
<div class="centered">
This no longer works well on Chrome 38. Try loading the dead center site above and resizing the browser - see the distortion in the text.