How can we float divs with scroll bar - css-float

There are two div on the right and on the left.How can I float right div with the vertical scroll bar can you write an example Please help : (

Here you go, divs are floating in this example:
You can do it by applying this css:
position:fixed;
top:20px;
right:0;
JsFiddle

Related

How to understand the behaviour of 'right' and 'bottom' in CSS positioning?

Please check this fiddle
https://jsfiddle.net/manuchadha/rc0dxog1/12/
How does bottom and right work in css as in the following example? They don't seem to have any effect.
HTML
<div id="div3"> top left bottom right div</div>
CSS - this CSS moves the div as per top and left. Right and bottom have no effect.
div#div3 {
width:100px;
height:100px;
background-color:#eaf;
position:relative;
top:50px;
left:50px;
right:50px;
bottom:50px;
}
This CSS moves the div up as expected.
div#div3 {
width:100px;
height:100px;
background-color:#eaf;
position:relative;
right:50px;
bottom:50px;
}
But this CSS seems to give top and left priority over bottom and right.
div#div3 {
width:100px;
height:100px;
background-color:#eaf;
position:relative;
right:50px;
bottom:50px;
top:50px;
left:50px;
}
What is the expected behavior if I give all four properties in the CSS - top, left, bottom, right? Shall I specify only one of right or left and one of bottom or top?
With position:relative, you cannot specify all four at once. In fact this only makes sense if you are using position:absolute.
relative means 'shift the element a certain amount vertically and horizontally relative to its normal position'. If you specify left:10px and right:10px at the same time, what does that mean? Should the browser move the element to the left or to the right? It is not clear. So, in practice, one rule is simply ignored.
Take a look at MDN's article on CSS position:
Except for the case just described (of absolutely positioned elements filling the available space):
If both top and bottom are specified (technically, not auto), top wins.
If both left and right are specified, left wins when direction is ltr (English, horizontal Japanese, etc.) and right wins when direction is rtl (Persian, Arabic, Hebrew, etc.).
You should save calling top left right and bottom for position: absolute
Try calling margin-right and margin-bottom

I cannot manage to create this layout in Vuejs element

Hi I tried all possible css combinations i can think of ,but i cannot manage to create a layout like this.
everything scrolls including navbar and Tab controlls.
<el-row>
<el-menu class="el-menu-demo" mode="horizontal"> ..</<el-menu>
</el-row>
<el-row>
<el-tabs>
<el-tab-pane>...</el-tab-pane>
<el-tabs>
</el-row>
final expected outcome
This has nothing to do with Vue.JS, but it's just plain CSS that is of problem here.
Typically, to have such "full-window" layouts with fixed elements (like navbar, footer), it's best to use absolute positioning for these elements.
I've created a small JSFiddle that creates such a layout:
https://jsfiddle.net/5wgb94kv/
Basic ideas:
the navigation bar is positioned absolutely to the top of the window with a fixed height (in CSS: position:absolute; top:0; height:25px;).
the tab bar is also positioned absolutely to the top, but below the nabber. (CSS: position:absolute; top:25px; height:25px;)
the footer is positioned absolutely to the bottom (CSS: position:absolute; bottom:0; height:25px;)
the content is positioned absolute as well, with the correct insets from top and bottom, and with overflow-x set to scroll. CSS: position:absolute; top: 50px; bottom:25px; overflow-x: scroll;
See the jsfiddle for the full css details.

Display table css float to right

I have 2 table-cell as demo below. I wanted to make the left block (white block) to place in right place and the right block in the left place without removing table-cell.
The idea is I want to put the white block on the top of black block in responsive. Just like the float left and float right.
Here is the Jsfiddle Demo
Thanks!
You have to include float:left and float:right to the layers and include the property box-sizing:border-box to the style .table-cell
https://jsfiddle.net/MAXXALANDER/mgpu4nqs/3/
.table-cell{
display:table-cell;
width:50%;
padding:5px;
box-sizing:border-box;
}

css "position:fixed; overflow:auto;" bad bottom padding

Page Fixed right-hand side and place under the headline.
jsfiddle exapmle looks the way I want, but the scroll bar is beyond the edge of the screen. How to fix this situation?
position:fixed;
top:120px;
bottom:0;
padding-bottom:120px;
overflow:auto;
height: 100%
jsfiddle exapmle of use
deleting height:100% on .main-body-grid > .grid-left, .main-body-grid > .grid-right and .main-body-grid > .grid-left worked for me

How to position overflown 'divs' side by side

DEMO HERE
I have two divs in a container. Both divs have 100% and 100% height. How do I position those divs side by side?
I tried float:left and display:inline-block but nothing seems to work. Second div is always under first div, not side by side
P.S. I don't want to use absolute position and I want one div overflown.
If both of them has 100% width you can't get the second one side by side. You should use "width: 50%" in those divs (I suppose they didn't have margins or padding), and then "float:left" the first one. The second one should go to the right of the first one.
If you want to add both div side by side you can not set div width 100%, you can set width 50% to check both are side by side without using display:inline-block
.innerDivs{
width:50%; // Change 100% to 50%
height:100%;
float:left;
}
Check this Demo
You should add overflow:hidden; property in outer div to solve this
Check this Demo
HTML
<div style="width:300px;height:100px;border:3px solid black;margin-top:100px;margin-left:100px;overflow:hidden;">
<div class="innerDivs" style="background:orange"></div>
<div class="innerDivs" style="background:red"></div>
</div>
CSS
.innerDivs{
width:100%;
height:100%;
float:left;
}

Resources