I'm stumbling on a problem with some divs that have contenteditable set to true. Whenever i add text into the divs, they jump to a new position. Only when all divs are empty or all are filled with text, they have the same relative position.
You can find a JSfiddle with the code here.
What am i doing wrong?
Here is the code:
.editor_table {
position: relative;
display: table;
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
.editor_row {
display: table-row;
}
.editor_cell {
display: table-cell;
border: none;
border-spacing: 5px;
width: 22%;
padding: 0px;
}
.editor_onvoldoende {
background: #F00
}
.editor_voldoende {
background: #FF0;
}
.editor_goed {
background: #0F0;
}
.editor_uitstekend {
background: #1B1;
}
.editor_onvoldoendead {
background: #F00
}
.editor_voldoendead {
background: #FF0;
}
.editor_goedad {
background: #0F0;
}
.editor_uitstekendad {
background: #1B1;
}
.editor_subject {
position: relative;
display: table-cell;
border: none;
width: 100px;
padding: 10px;
vertical-align: middle;
}
.editor_subject_input {
position: relative;
width: 100%;
border: none;
box-shadow: 5px 5px 10px 0px rgba(0, 0, 0, 0.05), 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
}
.editor_inner_cell {
margin: 5px;
height: 90px;
box-shadow: 5px 5px 10px 0px rgba(0, 0, 0, 0.05), 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
}
.editor_textarea {
position: relative;
height: 100%;
width: 100%;
border: none;
}
<div class="editor_table">
<div id="editor_a1" class="editor_row">
<div class="editor_subject">
<h3>
<input type="text" name="editor_subject1" class="editor_subject_input">
</h3>
</div>
<div id="editor_io" class="editor_cell">
<div id="editor_io_content" class="editor_onvoldoendead editor_inner_cell" contenteditable="true">
</div>
</div>
<div id="editor_iv" class="editor_cell">
<div id="editor_iv_content" class="editor_voldoendead editor_inner_cell" contenteditable="true">
</div>
</div>
<div id="editor_ig" class="editor_cell">
<div id="editor_ig_content" class="editor_goedad editor_inner_cell" contenteditable="true">
</div>
</div>
<div id="editor_iu" class="editor_cell">
<div id="editor_iu_content" class="editor_uitstekendad editor_inner_cell" contenteditable="true">
</div>
</div>
</div>
</div>
Replace your css class with below mention: I have added "float:left" and increased your width.
.editor_cell {
display: table-cell;
border: none;
border-spacing: 5px;
width: 24%;
padding: 0px;
float: left;
}
/* ------------------ */
/* CSS for the editor */
/* ------------------ */
.editor_table {
position: relative;
display: flex;
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
.editor_row {
display: flex;
}
.editor_cell {
border: none;
border-spacing: 5px;
width: 22%;
padding: 0px;
width: 90px;
}
.editor_onvoldoende {
background: #F00
}
.editor_voldoende {
background: #FF0;
}
.editor_goed {
background: #0F0;
}
.editor_uitstekend {
background: #1B1;
}
.editor_onvoldoendead {
background: #F00
}
.editor_voldoendead {
background: #FF0;
}
.editor_goedad {
background: #0F0;
}
.editor_uitstekendad {
background: #1B1;
}
.editor_subject {
position: relative;
border: none;
width: 100px;
padding: 10px;
vertical-align: middle;
}
.editor_subject_input {
position: relative;
width: 100%;
border: none;
box-shadow: 5px 5px 10px 0px rgba(0,0,0,0.05),0px 0px 10px 0px rgba(0,0,0,0.1);
}
.editor_inner_cell {
margin: 4px;
height: 90px;
box-shadow: 5px 5px 10px 0px rgba(0,0,0,0.05),0px 0px 10px 0px rgba(0,0,0,0.1);
}
.editor_textarea {
position: relative;
height: 100%;
width: 100%;
border: none;
}
<div class="editor_table">
<div id="editor_a1" class="editor_row">
<div class="editor_subject">
<h3>
<input type="text" name="editor_subject1" class="editor_subject_input">
</h3>
</div>
<div id="editor_io" class="editor_cell">
<div id="editor_io_content" class="editor_onvoldoendead editor_inner_cell" contenteditable="true">
</div>
</div>
<div id="editor_iv" class="editor_cell">
<div id="editor_iv_content" class="editor_voldoendead editor_inner_cell" contenteditable="true">
</div>
</div>
<div id="editor_ig" class="editor_cell">
<div id="editor_ig_content" class="editor_goedad editor_inner_cell" contenteditable="true">
</div>
</div>
<div id="editor_iu" class="editor_cell">
<div id="editor_iu_content" class="editor_uitstekendad editor_inner_cell" contenteditable="true">
</div>
</div>
</div>
</div>
If you are able to make the switch, I would strongly recommend display: flexto solve this problem.
Related
im pulling data from a db, im using while loop (php) to build a a small box with different data inside, and a button to access that id and display the rest of the information, the problem is that when i add margin or padding to the div the link href buttons become unclickable, i dont even get the hover effect, funny thing is that it does not happen to all the small divs created, the ones from the left side works, i get the hover effect and the links working fine, but the ones on the middle and right column simply doesnt work, if i remove the padding all buttons works fine but the whole items appear in a place that i dont want them, heres my code, hope you can help. THX.
HTML
<div class="row col-xs-4 col-md-4 col-lg-4 foot">
<div class="izq" style="margin-left:135px;">
<div class="sombra fondoCuadro blk">
<div class="pix esquinas"><img src='.$rows['thumbnail'].' /></div>
<div class="tamano12 clrA ngta der">'.$rows['precio'].'</div>
<div class="clr"></div>
<div class="linea fA"></div>
<div class="tamano12 clrG ngta" style="text-align:right;">'.$rows['titulo'].'</div>
<div class="clr"></div>
<div class="tamano11 clrG izq txt" style="margin-top:1px;">'.$rows['terreno'].' m² terreno</div>
<div class="clr"></div>
<div class="tamano11 clrG izq txt" style="margin-top:1px;">'.$rows['construccion'].' m² de construcción</div>
<div class="clr"></div>
<div>Detalles</div>
<div class="clr"></div>
</div>
</div>
</div>
CSS
.izq {
float: left;
}
.outMarco {
padding-left: 130px;
position: relative;
width: 73.2%;
}
.sombra {
-webkit-border-radius: 6px;
-webkit-box-shadow: 0px 0px 10px -3px #C5C5C5;
box-shadow: 0px 0px 10px -3px #C5C5C5;
border-radius: 6px;
}
.fondoCuadro {
background-color: #FFF;
}
.blk {
width: 222px;
min-height: 270px;
float: left;
margin-right: 16px;
padding: 5px;
position: relative;
border: 1px solid #FFF;
}
.blk:hover {
border: 1px solid #999;
}
.blk .pix {
width: 210px;
height: 142px;
overflow: hidden;
margin-bottom: 5px;
position: relative;
}
.blk .pix img {
width: 100%;
margin-top: -4%;
}
.esquinas {
-webkit-border-radius: 3px;
border-radius: 3px;
}
.new {
background-image: url(img/new.png);
background-repeat: no-repeat;
width: 53px;
height: 22px;
}
.blk .new {
position: absolute;
right: -5px;
top: 13px;
}
.tamano12 {
font-size: 12px !important;
}
.tamano11 {
font-size: 11px !important;
}
.clrG {
color: #555555;
}
.ngta {
font-weight: bold;
}
.clrA {
color: #13469B;
}
.der {
float: right;
}
.clr {
clear: both;
height: 1px;
}
.fA {
background-color: #13469B;
}
.linea {
height: 1px;
margin-top: 3px;
margin-bottom: 3px;
}
.blk .txt {
margin-bottom: 4px;
margin-top: 4px;
}
I'm trying to create a div that stays under the bottom of the page and is invisible there. I mean, you can't scroll to it. I tried to google it, but I just can't make it, neither negative bottom-margin, nor negative bottom, nor relative/absolute positioning couldn't make it...
Could anyone of you help me, please?
Here's a snippet of my site - I wanna "Menu" image to be invisible on the bottom (outside the display area), so it can then slide up when needed.
body {
overflow-x: hidden;
margin: 0;
padding: 0;
}
.main-container {
width: 100vw;
height: 100vh;
background-color: #780d0d;
position: absolute;
}
.mainmenu {
width: 70vw;
height: 82vh;
position: relative;
top: 8vh;
left: 15vw;
-webkit-box-shadow: 0px 0px 66px 10px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0px 0px 66px 10px rgba(0, 0, 0, 0.75);
box-shadow: 0px 0px 66px 10px rgba(0, 0, 0, 0.75);
}
.menu-bottom {
height: 20%;
width: 33.2%;
background-color: red;
border: 1px solid;
display: inline-block;
margin: 0 -5px 0 0;
}
.menu-side-holder {
height: 80%;
width: 30%;
display: inline-block;
}
.menu-side {
height: 50%;
background-color: red;
border: 1px solid;
display: block;
margin: 0;
vertical-align: top;
}
#menu-img {
height: 80%;
width: 40%;
display: inline-block;
margin: 0 -4px;
vertical-align: top;
clear: none;
}
.menu-bottom-slider {
display: inline-block;
width: 100%;
background-color: green;
}
#slider {
position: absolute;
padding-left: 43.5%;
bottom: 0;
margin-bottom: -30vh;
}
<div class="main-container">
<div class="mainmenu">
<div class="menu-side-holder">
<div class="menu-side" id="ogloszenia">
1
</div>
<div class="menu-side">
3
</div>
</div>
<img id="menu-img" src="img/main4.jpg">
<div class="menu-side-holder">
<div class="menu-side">
3
</div>
<div class="menu-side">
4
</div>
</div>
<div class="menu-bottom">
5
</div>
<div class="menu-bottom">
6
</div>
<div class="menu-bottom">
7
</div>
<div class="menu-bottom-slider">
<img id="slider" src="http://s32.postimg.org/xrrmzmohx/slider.png">
</div>
</div>
</div>
place your target div as direct child of body (not nested inside other divs) and use this style:
position:absolute;
bottom:-100% // or fixed size if height is known
One way you might be able to do this is by making it absolute and give it a negative bottom equal to the height of the element like so
.menu-bottom-slider{
position: absolute;
bottom: -(height of element goes here)px
}
Why don't you put
opacity: 0
on the element and position it where you need it ON the page. Then when you want to use it, use jQuery to change the opacity and animate it.
This would be the css of your div section.
#divname {
position:fixed;
height:50px;
background-color:red;
bottom:0px;
left:0px;
right:0px;
margin-bottom:0px;
}
Your body would look like this.
**body{
margin-bottom:50px;
}**
Your code is nearly working, but you are using overflow-x, and you need overflow-y.
EDIT:
Another way is to set the position of the slider to fixed. This means that the position does not depend on the scroll position, so you can't scroll to it:
body {
overflow-x: hidden; /* you could also change this to overflow-y */
margin: 0;
padding: 0;
}
.main-container {
width: 100vw;
height: 100vh;
background-color: #780d0d;
position: absolute;
}
.mainmenu {
width: 70vw;
height: 82vh;
position: relative;
top: 8vh;
left: 15vw;
-webkit-box-shadow: 0px 0px 66px 10px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0px 0px 66px 10px rgba(0, 0, 0, 0.75);
box-shadow: 0px 0px 66px 10px rgba(0, 0, 0, 0.75);
}
.menu-bottom {
height: 20%;
width: 33.2%;
background-color: red;
border: 1px solid;
display: inline-block;
margin: 0 -5px 0 0;
}
.menu-side-holder {
height: 80%;
width: 30%;
display: inline-block;
}
.menu-side {
height: 50%;
background-color: red;
border: 1px solid;
display: block;
margin: 0;
vertical-align: top;
}
#menu-img {
height: 80%;
width: 40%;
display: inline-block;
margin: 0 -4px;
vertical-align: top;
clear: none;
}
.menu-bottom-slider {
display: inline-block;
width: 100%;
background-color: green;
}
#slider {
position: fixed; /* This fixes the slider, you can't scroll to it! */
padding-left: 43.5%;
bottom: 0;
margin-bottom: -30vh;
}
<div class="main-container">
<div class="mainmenu">
<div class="menu-side-holder">
<div class="menu-side" id="ogloszenia">
1
</div>
<div class="menu-side">
3
</div>
</div>
<img id="menu-img" src="img/main4.jpg">
<div class="menu-side-holder">
<div class="menu-side">
3
</div>
<div class="menu-side">
4
</div>
</div>
<div class="menu-bottom">
5
</div>
<div class="menu-bottom">
6
</div>
<div class="menu-bottom">
7
</div>
<div class="menu-bottom-slider">
<img id="slider" src="http://s32.postimg.org/xrrmzmohx/slider.png">
</div>
</div>
</div>
Normally the elements of an HTML markup appear in the order they are written in the markup file, and the inline elements appear from left to right.
But I want the children of a certain div (only, NOT all the elements of the entire page) to appear from right to left.
In case you wonder why it is needed, I want to do this to solve the following problem:
PROBLEM:
JSFiddle here.
.wrapper {
height: 100%;
width: 826px;
margin: 50px auto;
display: table;
background-color: #003b80;
}
.cell {
display: table-cell;
vertical-align: top;
}
.left-cell {
width: 50%;
background-color: chocolate;
}
.right-cell {
background-color: darkslategrey
}
.step-container {
max-height: 200px;
font-size: 0;
}
.right-cell .step-container {
margin-top: 125px;
}
.content-box {
display: inline-block;
width: 350px;
height: 200px;
/*border: 5px solid blue;*/
font-size: 0;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.69);
-moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.69);
-webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.69);
background-color: dodgerblue
}
.right-cell .content-box {
background-color: darkturquoise
}
.middle-cell {
height: 100%;
background-color: white;
width: 1.5px;
font-size: 0;
box-shadow: 0px 0px 10px black;
-moz-box-shadow: 0px 0px 10px black;
-webkit-box-shadow: 0px 0px 10px black;
}
.number-outer-container {
display: inline-block;
position: absolute;
}
.left-cell .number-outer-container {
/*margin-left:39px;*/
}
.number-inner-container {
height: 200px;
display: flex;
flex-direction: column;
justify-content: center;
}
.number-banner {
width: 50px;
height: 50px;
background-color: crimson;
-moz-border-radius: 25px;
-webkit-border-radius: 25px;
border-radius: 25px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
}
.notch-outer-container {
display: inline-block;
}
.left-cell .notch-outer-container {
margin-right: 24px;
}
.right-cell .notch-outer-container {
margin-left: 10px;
}
.notch-inner-container {
height: 200px;
display: flex;
flex-direction: column;
justify-content: center;
}
.notch {
width: 0;
height: 0;
border-top: 15px solid transparent;
border-bottom: 15px solid transparent;
}
.left-face-notch {
border-right: 15px solid #520f23;
}
.right-face-notch {
border-left: 15px solid #571780;
}
<div class="wrapper">
<div class="cell left-cell" align="left">
<div class="step-container">
<div class="content-box"></div>
<div class="notch-outer-container">
<div class="notch-inner-container">
<div class="right-face-notch notch"></div>
</div>
</div>
<div class="number-outer-container">
<div class="number-inner-container">
<div class="number-banner"></div>
</div>
</div>
</div>
</div>
<div class="cell middle-cell"></div>
<div class="cell right-cell" align="right">
<div class="step-container">
<div class="number-outer-container">
<div class="number-inner-container">
<div class="number-banner"></div>
</div>
</div>
<div class="notch-outer-container">
<div class="notch-inner-container">
<div class="left-face-notch notch"></div>
</div>
</div>
<div class="content-box"></div>
</div>
</div>
</div>
In this SSCCE, inside .left-cell .step-container, I have three elements appearing on the same line: .content-box, .notch-outer-container, and .number-outer-container; and to make the .notch appear to be overlapping the right-cell by 50% of its width, I gave .number-outer-container a position:absolute; and .notch-outer-container a margin-right which pushes the number-outer-container to right side to an extent that it appears to be overlapping the (.middle-cell and) right-cell by 50% of it's width.
The problem is that in the .right-cell, this strategy is NOT working. First the .number-right-container appears and still it is absolute, I can not give it a left property with value relative to its parent (otherwise I would try a left:-25px to make it appear 25px behind the left edge of its parent, because it has width:50px;). Then the .notch is hidden below it...
So I am thinking about finding a way through which I can get the elements render from RTL (Right To Left) rather than LTR only inside .right-cell on the page. So that I can follow the same strategy I have used for the .left-cell, in the .right-cell.
There's numerous ways to achieve what you want using either flexing, floats or other options, but I'd say one of the easiest ways, if the rest of the layout works as you want it to, is to use the direction attribute.
div {
direction: rtl;
}
div div {
display: inline-block;
direction: ltr;
}
<div>
<div>first</div>
<div>second</div>
<div>last</div>
</div>
What I already have:
.modal-m1
{
background-image: url(../images/bg-greyout.png);
background-repeat: repeat;
display: table;
top: 0;
left: 0;
width: 100%;
height: 100%;
position: fixed;
margin: 0;
padding: 0;
z-index: 1;
}
.modal-m1 .modal-m2
{
display: table-cell;
vertical-align: middle;
}
.dialogbox
{
margin: 0 auto;
background-color: #F6F6F6;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
-webkit-box-shadow: #666 3px 3px 5px;
-moz-box-shadow: #666 3px 3px 5px;
box-shadow: #666 3px 3px 20px;
padding: 20px;
}
.mydialogbox
{
width: 400px;
}
<div class="modal-m1">
<div class="modal-m2">
<div class="dialogbox mydialogbox">
... CONTENT IS HERE ......
</div>
</div>
</div>
Everything is okay on that stage. You may test it on snippet.
Now I want to put several dialog boxes to different pages. I'm trying to reuse the code and for that reason I'm trying to extract modal-m1, modal-m2 and dialogbox to ASP.NET user control. mydialogbox must become a nested div inside of dialogbox. But dialogbox ignores width: 400px in this case. Is there any workaround?
In other words, I want my markup to be:
<div class="modal-m1">
<div class="modal-m2">
<div class="dialogbox">
<div class="mydialogbox">
... CONTENT IS HERE ......
</div>
</div>
</div>
</div>
Is it possible?
if I undestood..
your html can be like this:
<div class="modal-m1">
<div class="modal-m2">
<div class="dialogbox ">
<div class="mydialogbox">
<div>CONTENT IS HERE ......</div>
</div>
</div>
</div>
</div>
and you want put width only for .mydialogbox
.modal-m1 .modal-m2
{
display: table-cell;
vertical-align: middle;
text-align:center; /*add*/
}
.dialogbox
{
margin: 0 auto;
background-color: #F6F6F6;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
-webkit-box-shadow: #666 3px 3px 5px;
-moz-box-shadow: #666 3px 3px 5px;
box-shadow: #666 3px 3px 20px;
padding: 20px;
display:inline-block; /*change*/
}
.mydialogbox
{
width: 400px;
text-align:left
}
is this?
I have a pretty simple div structure - tree boxes with middle box highlighted with box-shadow:
.offerBox {
width: 300px;
margin: 10px;
}
.obOffer {
width: 33%;
float: left;
height: 100px;
text-align: center;
}
.obOfferPrice {
padding: 10px;
color: white;
background-color: #85AADD;
}
.obHiLight {
box-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
-moz-box-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
-webkit-box-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
}
<div class="offerBox">
<div class="obOffer">
<div class="obOfferTitle">Free</div>
<div class="obOfferPrice">Free</div>
</div>
<div class="obOffer obHiLight">
<div class="obOfferTitle">Title</div>
<div class="obOfferPrice">$10</div>
</div>
<div class="obOffer">
<div class="obOfferTitle">Title 2</div>
<div class="obOfferPrice">$10</div>
</div>
</div>
One of the elements inside those boxes have a background-color property set. For some reasons this background-color removes the box-shadow from the right and only from the right.
Any ideas why and how to fix it?
Live Example of the problem:
http://jsfiddle.net/SqvUd/
You just need to add z-index and position:relative;
See the example:
.offerBox {
border-radius: 6px;
width: 300px;
margin: 10px;
}
.obOffer {
position: relative; // 👈 this
width: 33%;
float: left;
height: 100px;
text-align: center;
z-index: 0;
}
.obOfferPrice {
padding: 10px;
color: white;
background-color: #85AADD;
}
.obHiLight {
z-index: 10;
box-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
}
<div class="offerBox">
<div class="obOffer">
<div class="obOfferTitle">Free</div>
<div class="obOfferPrice">Free</div>
</div>
<div class="obOffer obHiLight">
<div class="obOfferTitle">Title</div>
<div class="obOfferPrice">$10</div>
</div>
<div class="obOffer">
<div class="obOfferTitle">Title 2</div>
<div class="obOfferPrice">$10</div>
</div>
</div>
It has to do with the z-index of the items. Try adding this to your existing css:
.obOffer {
position: relative;
z-index: 10;
}
.obHiLight {
position:relative;
z-index: 100;
}
adding .obHiLight{opacity:0.999} creates a new stacking context for that element, which makes it appear above the others as well. This might work for tables too (didn't test :) . #ItJustWerks #brian-tacker