I'm trying to get the icon in the second wrapper div to cross up and dissect the previous wrapper div but the half that is supposed to appear in the div above will not appear. Even with a higher z-index. If I change the wrapper div overflow or position styles, it throws everything off. What is the correct way to do this? Here is the html and the css:
.wrapper {
position: relative;
width: 100%;
padding-bottom: 40px;
height: auto;
clear: left;
overflow: auto;
z-index: 1;
}
.process {
width: 100%;
height: 100%;
z-index: 1;
}
.process .icon {
position: relative;
height: 123px;
width: 123px;
margin-top: -60px;
border-radius: 50%;
z-index: 3;
}
<div class="wrapper">
<div class="page-heading">
<div class="col-md-6 col-centered">
</div>
</div>
</div>
<div class="wrapper blue">
<div class="process">
<div class="icon blue border-blue col-centered">
</div>
<div class="col-md-4 col-md-offset-1">
<div class="entry-content">
</div>
</div>
<div class="col-md-7 padding-right-100">
</div>
</div>
</div>
There is no table display necessary. What you need are actual heights for all elements - auto height won't work with no content, and 100% height only works if the parent container's height ( in this case body) is also defined. I made the body 100% and the two wrappers 50% .
The circle DIV has been centered horzontally with margin: 0 auto and pushed up using top: -60px while having: position: relative. The z-indexes remained unchanged 1 for the wrappers, 3 for the circle/icon (could also be 2).
There is also a codepen at http://codepen.io/anon/pen/KgNXmj
html, body {
height: 100%;
margin: 0;
}
.wrapper {
width: 100%;
height: 50%;
z-index: 1;
background: green;
}
.process {
width: 100%;
height: 100%;
z-index: 1;
background: blue;
}
.process .icon {
position: relative;
top: -60px;
margin: 0 auto;
height: 123px;
width: 123px;
background: #f00;
border-radius: 50%;
z-index: 3;
}
<div class="wrapper">
<div class="page-heading">
<div class="col-md-6 col-centered">
</div>
</div>
</div>
<div class="wrapper blue">
<div class="process">
<div class="icon blue border-blue col-centered">
</div>
<div class="col-md-4 col-md-offset-1">
<div class="entry-content">
</div>
</div>
<div class="col-md-7 padding-right-100">
</div>
</div>
</div>
After much research and hair-pulling, I found a solution that works. Not sure WHY, but the parent div had to have display:table and the child div display:table-row. If anyone knows why this works, definitely feel free to share.
Related
I want to make this:
stacked cards
the html would look like so:
<div class="container>
<div class="top-card>
<div class="card-content">
...
</div>
</div>
<div class="bottom-card>
</div>
</div>
I am having trouble styling this so that the height of the entire card adjusts automatically according to the content inside the top card. Thank you in advance.
you can use a combination of box-shadow and display: inline-block to accomplish what you are trying to do. I have updated the answer. Here is the code:
.grandparent {
display: inline-block;
position: relative;
}
.parent {
display: inline-block;
background: blue;
position: absolute;
top: 0;
left: 0;
}
.child {
width: 100px;
height: 100px;
background: red;
margin: 5px;
}
.shadow {
margin-left: -7px;
margin-top: -7px;
background: pink;
z-index: -100;
border: 1px solid green;
}
.empty {
opacity: 0;
}
<div class="grandparent">
<div class="parent">
<div class="child"></div>
</div>
<div class="parent shadow">
<div class="child empty"></div>
</div>
</div>
I'm trying to re-create cell freezing just like in any popular spreadsheet program. In addition, each cell can have a dropdown with dropdown-body which should be displayed to select an option.
The problem
The dropdown-body is relatively positioned, wrapped in an element with absolute position. When I use this dropdown in the frozen part (which has position: sticky), the body is "hidden" inside the overflow viewport. I tried to adjust this by specifying z-index on the wrapper and the .cell-content-wrapper and .cell-content with no luck. Is there a possibility to bring the .cell-content to the front?
Any help appreciated.
#wrapper {
width: 600px;
min-height: 150px;
overflow: scroll;
}
.row {
display: flex;
width: 100%;
}
.cell {
display: inline-flex;
min-width: 70px;
overflow: hidden;
border: 1px solid gray;
}
.frozen-part {
background: lightblue;
display: flex;
position: sticky;
left: 0;
}
.cell-content-wrapper {
position: absolute;
}
.cell-content {
position: relative;
top: 25px;
width: 100px;
height: 300px;
background: #7cfc00;
}
<div id="wrapper">
<div class="row">
<div class="frozen-part">
<div class="cell">Cell</div>
<div class="cell">Cell</div>
<div class="cell">
Dropdown
<div class="cell-content-wrapper">
<div class="cell-content">
This should be in front
</div>
</div>
</div>
<div id="dropdown"></div>
</div>
<div class="cell">Cell</div>
<div class="cell">Cell</div>
<div class="cell">
Dropdown
<div class="cell-content-wrapper">
<div class="cell-content">
This is a desired behavior
</div>
</div>
</div>
<div class="cell">Cell</div>
<div class="cell">Cell</div>
<div class="cell">Cell</div>
<div class="cell">Cell</div>
<div class="cell">Cell</div>
</div>
</div>
I am attempting to add the wrapperleft and wrapperright divs inside of the bareEditorial div without it affecting the positioning of any of the elements within the bareEditorial div. I want the cursor to change from the left 50% of the viewport to the right 50% within this div
Does anyone have any suggestions on how to achieve this?
Here is my pen https://codepen.io/anon/pen/XQeGMZ
.wrapperleft {
width: 50vw;
display: inline-block;
cursor: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSIyNnB4IiB2aWV3Qm94PSIwIDAgNDAgMjYiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQxLjEgKDM1Mzc2KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5TaGFwZTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwb2x5Z29uIGlkPSJTaGFwZSIgZmlsbD0iIzAwMDAwMCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjAuMDAwMDAwLCAxMi44MDIwMDApIHNjYWxlKC0xLCAxKSB0cmFuc2xhdGUoLTIwLjAwMDAwMCwgLTEyLjgwMjAwMCkgIiBwb2ludHM9IjI3LjE5OCAyNS42MDQgMzkuNDk0IDEzLjMwOCA0MCAxMi44MDIgMzkuNDk0IDEyLjI5NiAyNy4xOTggMCAyNi4xODUgMS4wMTIgMzcuMjYgMTIuMDg2IDAgMTIuMDg2IDAgMTMuNTE4IDM3LjI2IDEzLjUxOCAyNi4xODUgMjQuNTkyIj48L3BvbHlnb24+CiAgICA8L2c+Cjwvc3ZnPg=="), auto;
}
.wrapperright {
width: 50vw;
display: inline-block;
float: right;
cursor: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0nNDAnIGhlaWdodD0nMjYnIHZpZXdCb3g9JzAgMCA0MCAyNicgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJz48cGF0aCBkPSdNMjcuMTk4IDI2LjYwNGwxMi4yOTYtMTIuMjk2LjUwNi0uNTA2LS41MDYtLjUwNkwyNy4xOTggMWwtMS4wMTMgMS4wMTJMMzcuMjYgMTMuMDg2SDB2MS40MzJoMzcuMjZMMjYuMTg1IDI1LjU5MnonLz48L3N2Zz4K"), auto;
}
<div class="wrapperleft" onclick="plusSlides(-1)"></div>
<div class="wrapperright" onclick="plusSlides(1)"></div>
<div class="bareEditorial">
<div class="slideshow-container">
<h1>Bare Boutique Campaign</h1>
<div class="mySlides fade">
<div class="image">
<img src="https://static1.squarespace.com/static/5a24d00449fc2b2179f0b620/t/5c7118acc830251242312b94/1550915797860/web+7.jpg?format=2500w" onclick="plusSlides(1)">
</div>
</div>
<div class="mySlides fade">
<div class="image">
<img src="https://static1.squarespace.com/static/5a24d00449fc2b2179f0b620/5c7116541905f442e8f008e0/5c7124951905f442e8f048fd/1550918837321/web+3.jpg?format=1000w" onclick="plusSlides(1)">
</div>
</div>
<div class="mySlides fade">
<div class="image">
<img src="https://static1.squarespace.com/static/5a24d00449fc2b2179f0b620/t/5c711846ec212dd3a55665b8/1550915727165/web+5.jpg?format=2500w" onclick="plusSlides(1)">
</div>
</div>
<div class="nextprevious">
<div class="numbertext">(<span>3</span> / <span>3</span>)</div>
</div>
</div>
</div>
Hi you can use "position: absolute" as the css property to adjust Divs without affecting other elements.
I have edited your css, you can go through it n replace and check once,
.wrapperleft {
width: 50vw;
cursor: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiP…M3LjI2IDEzLjUxOCAyNi4xODUgMjQuNTkyIj48L3BvbHlnb24+CiAgICA8L2c+Cjwvc3ZnPg==), auto;
height: 50px;
background: blue;
position: absolute;
left: 0;
}
.wrapperright {
width: 50vw;
float: right;
cursor: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0nNDAnIGhlaWdodD0nMjYnIHZpZXdCb3g9J…4wMTJMMzcuMjYgMTMuMDg2SDB2MS40MzJoMzcuMjZMMjYuMTg1IDI1LjU5MnonLz48L3N2Zz4K), auto;
height: 50px;
background: red;
position: absolute;
right: 0;
}
I have a certaing layout of nested divs. One of them I would like to expand beyond its parent. However, with this nesting it's not that simple - I think.
Html:
<div class="wrapper">
<div class="gridcontent">
<div class="gcrow single-column">
<div class="gccolumn">
<div class="gccolumn-inner">
<div class="gcitem">
<p>Extend to .wrapper width</p>
</div>
</div>
</div>
</div>
</div>
</div>
I can't change the html, and there may be other .gcrows that need to stay inside the container. Is this possible to to at all?
Fiddle here.
I hope my question makes sense.
For your current HTML structure you can use .gcrow:first-child and set min-width: 100vw which is same as wrapper width if you remove default margin and padding from html, body.
You can use position: relative, left: 50% and to make it center just add transform: translateX(-50%), here is Fiddle
body,
html {
margin: 0;
padding: 0;
}
* {
box-sizing: border-box;
}
.wrapper {
width: 100%;
padding-left: 20px!important;
padding-right: 20px!important;
border: 1px solid pink;
}
.gridcontent {
width: 100%;
max-width: 1018px;
border: 1px solid #333;
margin: 0 auto;
}
.gcrow {
max-width: 100%;
width: 100%;
border: 1px solid #f00;
}
.gcrow:first-child {
min-width: 100vw;
position: relative;
left: 50%;
transform: translateX(-50%);
}
<div class="wrapper">
<div class="gridcontent">
<div class="gcrow single-column">
<div class="gccolumn">
<div class="gccolumn-inner">
<div class="gcitem">
<p>Extend to .wrapper width</p>
</div>
</div>
</div>
</div>
<div class="gcrow single-column">
<div class="gccolumn">
<div class="gccolumn-inner">
<div class="gcitem">
<p>Leave me alone</p>
</div>
</div>
</div>
</div>
</div>
</div>
Also its box-sizing: border-box not box-border
try something like this
.gcrow {
position: relative;
overflow: visible;
}
.gcitem {
position: absolute;
right: 0;
top: 0;
}
I want to make the image 70% visible stick with the bottom and the rest of it invisible behind the div. I follow the tutorial with z-index 10 position absolute and overflow:hidden. but the image still show and overlap on other div. Could you help me? thanks!
HTML
<div class="screenshot search">
<div class="container container-fluid">
<div class="row">
<div class="col-md-6">
<img class="img-responsive" src="./img/sc-search#2.jpg" alt="pencarian"/>
</div>
<div class="col-md-6">
<h3>
search
</h3>
<p>
test
</p>
</div>
</div>
</div>
</div>
CSS
.screenshot {
padding: 6em 0;
height: auto;
}
.screenshot img {
width: 400px;
max-width: 90%;
z-index: 10;
position: relative;
overflow: hidden;
}
.search {
background-color: #fafafa;
}
There are loads of methods to do what you want if I understand right - (a screenshot would help, also if you are including "working code" include a JS fiddle or codepen link) then the example below has working overlap of your content div and the image.
<div class="screenshot search">
<div class="container container-fluid">
<div class="row">
<div class="wrap">
<div class="col-md-6 image-wrap">
<img class="img-responsive" src="http://www.navipedia.net/images/a/a9/Example.jpg" alt="pencarian"/>
</div>
<div class="col-md-6 content">
<h3>search</h3>
<p>test</p>
</div>
</div>
</div>
</div>
</div>
.screenshot {
padding: 6em 0;
height: auto;
}
.wrap {
position:relative;
}
.screenshot img {
width: 400px;
max-width: 90%;
z-index: ;
position: absolute;
}
.image-wrap {
overflow:hidden;
position:relative;
height: 200px;
}
.content {
display:block;
background:white;
position:absolute;
top:0;
width:100%;
}
.search {
background-color: #fafafa;
}
Fiddle
Read about Z-index here