Fluid div next to fixed div - html

I have the Bootstrap framework for basis of the website.
Now, the main content is let's say is 1000px wide.
Then I have this 100% wide area, inside of which I have centered 1000px area.
But...
The left section is fixed width of 290px.
The right long section is fluid width and starts right from the border of the left section and it ends where the 100% wide container ends.
Inside of the right long section is 710px fixed content.
I want to have fluid width right content.
Image slider or google map or something.
I think the basic html should be:
<div class="wide_container">
<div class="container1000px">
<div class="left290px">
</div>
<div class="rightFluid">
<div class="right710px">
But inside of this the image slider should be wider than 710px.
And this website is responsive, too.
</div>
</div>
</div>
</div>
Thanks a lot for any ideas!
(Full image)

set .rightFluid to min-width:710px and add class pull-right.
.rightFluid{
min-width:710px;
}
<div class="rightFluid pull-right">
I think, this should work.
You can see reference here: http://jsfiddle.net/ashishanexpert/B8L6L/

for that u need to use structure like table -->
right-box will be fluid
<div class="table row-fluid">
<div class="left-box"></div>
<div class="center-box"></div>
<div class="right-box"></div>
</div>
<style>
.table {
display : table;
}
.table > .div {
display: table-cell;
}
.left-box {
width: fixed-with;
}
.center-box {
width: fixed-with;
}
</style>

in that photo i saw u need fluid space for left side that i dont know what should be the rule for width (fluid - something related to parent tag) , any way this link may be help u by extra little information about how this is work ,
Check here
in that link u saw the gray part , that gray part is fluid , other color part got fixed width , in any table if u use fix width for some table-cell and leave other with out set any width they will fill remind width n if this answer is not helpful it must be misunderstanding from me of ur problem
.table {
display : table;
height: 400px;
width: 100%;
background-color: #808080;
}
.table > div {
display: table-cell;
}
.right-box {
width: 300px;
background-color: blue;
}
.center-box {
width: 100px;
background-color: red;
}

OK guys, finally found the solution
HTML:
<div class="table">
<div class="row hidden">
<div class="cell"></div>
<div class="cell-centered">fixed width 600px; row in yellow just to show cell alignment, actually goes "hidden"</div>
<div class="cell"></div>
</div>
<div class="row">
<div class="cell">
</div>
<div class="cell-fixed"><div class="fixed"><br>fixed width 200px<br><br></div></div>
<div class="cell relative">
<div class="outer absolute"><div class="inner absolute">100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100%</div></div>
</div>
</div>
</div>
<div class="container"></div>
CSS:
body {margin: 0; text-align: center;}
.table {width: 100%; position: fixed; top: 50px;}
.row {display: table-row;}
.cell {
background: #ccc;
display: table-cell;
width: 50%;
}
.cell-centered {
background: #aaa;
display: table-cell;
min-width: 600px;
}
.cell-fixed {
background: #bbb;
display: table-cell;
min-width: 200px;
}
.fixed {
background: #1dcf53 ;
width: 200px;
}
.hidden .cell {background: #f0ff00 ;}
.hidden .cell-centered {background: #e0ee00;}
.relative {position: relative;}
.absolute {position: absolute;}
.outer {
width: 100%;
padding-right: 400px;
right: 0;
}
.inner {
background: #1dcfa6;
width: 100%;
right: 0;
}
.container {
background: #eee;
width: 600px;
height: 300px;
margin: auto;
}

Related

HTML / CSS | 2 divs next to each other - left div 250px and right div 100%

first of all I am trying to programming a website...
Now my question:
I want to have on the left side of my website a div which has a height of 100% and a width of 250px
On the right side of my website I want a div which has a height of 100% and a width of 100% too...
BUT
If I do this then my right div is to big for my Monitor but I want to have it perfectly fit so that i dont need to scroll to the right..
PS: I want that the left div is fixt on 250px width!
Hopefully anyone know what I mean
The white one is the left div | The black one is the right div
You can try flex: for more visit HERE
html, body {
height: 100vh;
}
#parent{
display: flex;
height: 100%;
}
#child1{
width:250px;
background-color:green;
}
#child2{
flex-grow: 1;
background-color:red;
}
<div id='parent'>
<div id='child1'>child1</div>
<div id='child2'>child2</div>
</div>
you want two divs? this should work
<body style="margin: 0px; padding: 0px;">
<div id="contairofthemall" style="width: 100%;">
<div id="divone" style="height:100%; width:250px; position: absolute;"></div>
<div id="divtwo" style="height:100%; width:100%; "></div>
</div>
</body>
html, body {}
#parent{
display: flex;
height: 100%;
width: 100%;
position: absolute;
top: 0px;
left: 0px;
}
#child1{
width:250px;
background-color:green;
}
#child2{
flex-grow: 1;
background-color:red;
}
<div id='parent'>
<div id='child1'>child1</div>
<div id='child2'>child2</div>
</div>

Content overflowing off page with bootstrap

I am using bootstrap and I am making my website when I created a fixed navigation bar on the left side of my page with the width of 250px and then I have a div to the right of it being my page content, I have set the width of that to 100% and inside that I have a col-lg-12 and the content is leaking off the page, I was wondering if anyone knew a solution to this so that the content box is only the width of the remaining width of the page instead of being always 100% of the page width, If you need the code I can upload it to pastebin or something like that. But I am putting just some lil tid bits of the code here. And if any more info is needed just comment.
.navigationWrapper {
position: absolute;
float: left;
width: 250px;
height: 100%;
background-color: black;
}
.contentWrapper {
left: 255px;
position: absolute;
float: left;
width: 100%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="navigationWrapper">
<div class="navIcon">
<span>ICON</span>
</div>
</div>
<div class="contentWrapper">
<div class="col-sm-12 test">
<h1>Test</h1>
</div>
</div>
you can use Flexbox to do this:
JsFiddle. There are some height properties, which should be fixed.
.wrapper {
display: flex;
}
.navigationwrapper {
flex: 0 0 250px;
}
.contentWrapper {
flex: 1 0 auto;
}
with flex: 1 0 auto you can grantee that the element will grow and take the rest of the space left.
and this is your updated Fiddle https://jsfiddle.net/Marouen/n9v4Ly7e/
You can use calc() in your CSS because the width of your container is not 100% but 100% - menu width
It makes something like : width: calc(100% - 255px); because you are starting your container from 255px left.
updated js fiddle
PS : i also added background-color:black; to your .navNav{} so the background works even if the viewport is smaller than the size of the menu.
The issue you are having is that the width: 100%; you have applied to the .contentWrapper referances the width of it's parent (in this case the body) and not remaining space. You can use width: calc(100% - 255px); (see updated example below) to fix the issue. Flex-box is also reasonable solution, but this is what was causing the issue.
.navigationWrapper {
position: absolute;
float: left;
width: 250px;
height: 100%;
background-color: black;
}
.contentWrapper {
left: 255px;
position: absolute;
float: left;
width: calc(100% - 255px);
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="navigationWrapper">
<div class="navIcon">
<span>ICON</span>
</div>
</div>
<div class="contentWrapper">
<div class="col-sm-12 test">
<h1>Test</h1>
</div>
</div>

CSS stack multiple full width divs

I have this markup:
<div id="wrapper">
<div id="container">
<div class="block"></div>
<div class="block"></div>
</div>
</div>
and this CSS:
#wrapper {
width: 100%;
overflow: hidden;
}
#container {
width: 200%;
}
.block {
width: 50%;
float: left;
}
Basically all I want to do is, have 2 fullwidth divs floating next to each other, but when I put some content in them I get container centered and pieces of both divs showing, like this: http://prntscr.com/8lr4l6
What am I doing wrong?
There is no need to set the width of the wrapper and of the container. It is always 100%, if nothing else is set. Just set a width of 50% to every block and float them left.
#wrapper {
overflow: hidden;
}
.block {
float: left;
width: 50%;
}
Example
would something like this work for you: http://jsfiddle.net/swm53ran/338/
you can see the div to by commenting out overflow: hidden
<div class="container">
<div class="block block1">
This is content for div 1 This is content for div 1 This is content for div 1
</div>
<div class="block block2">
This is content for div 2 This is content for div 2 This is content for div 2
</div>
</div>
body {
overflow: hidden;
}
.container {
width: 200%;
padding: 0px;
}
.block {
display: inline-block;
width: 50%;
float: left;
outline: 1px solid gray;
}
Boy, am I a fool!?
In my case answer was pretty simple. I had left autofocus attribute on my input which were on the off screen div, and of course it automatically scrolled to that div.
Thanks everyone for answers though. :)

CSS Image pos middle in dynamic proportionally height/width div

Need to solve this little task:
Center vertically and horizontally IMAGE in DIV.
DIV height must be proportional to width.
DIV width is stretchable (for example 50% of parent div).
IMAGE width and height = auto (it must fill div if its width or height > than div width or height, and have primary size if its < div size, and stay proportional).
I know how to make 2 and 3.
HTML:
<div class="container">
<img src="img.png"/>
</div>
CSS:
.container {
width: 100%;
height: 0;
padding-bottom: 100%;
}
But how to center and middle IMAGE in this DIV?
There is a lot of ways to make 1 task with non proportional and non strechable div.
But I dont know how to make it all in full house of tasks.
Can you help? HTML and CSS may be any.
Did you try :
.container img {
vertical-align : middle
}
? It will verticaly align your image.
Try this:
<style>
.container
{
width :100%;
height :100%;
display :table;
}
.child
{
vertical-align :middle;
display :table-cell;
}
.child img
{
display :block;
width :50%;
margin :0 auto;
}
</style>
<div class="container">
<div class="child">
<img src="img.png"/>
</div>
</div>
Solved it by myself. Check here: http://jsfiddle.net/42trk8ux/17/
HTML:
<div class="width-50">
<div class="parent">
<div class="aspect"></div>
<div class="block">
<div class="tbl">
<div class="tbl-cell">
<img src="img.jpg"/>
</div>
</div>
</div>
</div>
</div>
CSS:
.width-50{
width:50%
}
.parent{
position: relative;
}
.aspect
{
width: 100%;
height: 0;
padding-bottom: 100%;
box-sizing: border-box;
}
.block{
width: 100%;
height: 100%;
position: absolute;
top: 0;
display: block;
}
.tbl{
display: table;
width: 100%;
height: 100%;
position: absolute;
}
.tbl-cell{
display: table-cell;
vertical-align: middle;
text-align: center;
background: #aaa;
}
.tbl-cell img{
max-width:100%;
max-height:100%;
}

How can I place two divs next to each other so that if one is not there then the other div will expand?

How can I place two div's next to each other such that if one is not there, the other will expand?
<div class="main">
<div class="left"></div>
<div class="right"></div>
</div>
.main{width:100%}
.left{width:70%}
.right{width:30%}
if left is not there right will be 100%;
if right is not there left will be 100%;
Try like that:
.left{width:70%;}
.right{width:100%;}
.left+.right{width:30% !important;}
Try below classes with your div's, you can set the width of right-div to 100% if left div is absent, or set the width of left-div to 100% if right is absent
<div class=main-div">
<div class="left-div"></div>
<div class="right-div"></div>
</div>
.main-div {width: 100%}
.left-div {float: left;
background: yellow;
width: 50%;
height: 100%;
display: inline-block;}
.right-div {float: right;
background: red;
width: 50%;
height: 100%;
display: inline-block;}