vertically align div middle to dynamic height - html

I am currently trying to figure out an way to vertically align an div that is inside an div that has an dynamic height due to it's changing content.
So on this jsFiddle is the setup,
in the left div you have the content that is inside an wrapper element with an fixed width. Next to that div is another div, this is an wrapper for an image and a div element. And on the right is an element with an position absolute.
The idear is that the text "this is an image" is vertically aligned to the middle of the left div which is dynamic. I would like to do it with CSS but it seems impossible...
You can check out this fiddle to get some more info
http://jsfiddle.net/36sfx/2/

It seems that the only way to do it is displaying the div as table-cell. I have tried to solve this problem many times before, and I have read before that there are technicals limitation on this issue.

Related

how to check the scrolling of div within its parent div when window size is reduced

I am using bootstrap to design web application. I have two main divs, sidebar div with span 2 which has position : fixed and right div which is of span 10. These divs has float : left property as per bootstrap css file as I am using row-fluid class.
So the problem I am facing is when window size is reduced after certain limit, user is able to scroll the content of right div and which is overlapping with left div. So I want hide the content of right div which overlaps on left div ( ie. left div, the fixed div, should behave like a left wall of browser window for right div).
I have tried using overflow property and also tried changing z-index of divs, but nothing seems to be working here.
jsfiddle link - here is the link I have reproduced the problem, there if you scroll left in result area, you can see the content of right div is overlapping with left div(nav list), as I have given left-margin : 240px to rightDiv. So what I want is, the right div content should not overlap left div, and it should be hidden behind.
Any suggestion on how to get it right or is there any other way to achieve the same?
I'm not 100% sure exactly what you are trying to do. If it's just hiding whatever is overlapping then applying a background-color to the fixed div will achieve this.
JSFiddle.
You can left padding equal to the width of left navigation to prevent the overlapping (imitate)
padding-left:140px;
JSFiddle

Div moves down, while trying to keep it aligned with others

I have one parent div and multiple child divs placed in one row. These child divs are created dynamically, and I don't know how many of them will be created in the moment of rendering page. I want parent div to have fixed width, and to have horizontal scrollbar in case all child divs are not visible. This works fine.
But when I have content inside my child div, that div moves down, and it's not alligned with other divs.
I'm not sure where is the problem?
Here's the jsFiddle example.
I tried to put position:absolute to inner content of child div, but that didn't help much.
I added:
div {
vertical-align:top;
}
http://jsfiddle.net/LSZZx/30/

css centering issue on middle column

I have got an issue in a header where I want the middle element to stay centered between the two flash end pieces. I put the middle element after the right div in the html, thought I specified the css right, but when I STRETCH the page to the right, the middle element does not move/stay centered. Are you able to see what I'm doing wrong?
From looking at the code on the page you supplied, you need to remove the float:left from the headerCenter div

CSS vertical align not working properly

for reference here is a jsfiddle link:
http://jsfiddle.net/STmwz/4/
To start off with, there is only the top div. When the user clicks the edit button, I have some javascript to replace the top div with the bottom div. Problem is, when the replace happens, there is a slight twitch of sorts: everything jumps a couple of pixels.
I think the best way to fix this would be to have the top div vertically aligned. I have a height set for the top div that matches the height of the bottom div when it replaces the top one. So if both are aligned vertically, then no jump!
Problem is, vertical-align isn't working on the top div.
Any idea on what I could do?
I believe the elements that you want to vertically align must have "inline" or "table-cell" display.
Source: https://developer.mozilla.org/en/CSS/vertical-align
Here's an example of it working: http://jsfiddle.net/STmwz/19/

Turning a div into a link makes more than the div a link

When I try to turn a div into a link, all of the area to the right of the div also becomes a div. The div displays as a block and has a fixed width. When I make the div linkable, the white space to the right of the div becomes linked, too. I thought that making the div a block and fixing its width would make only the area inside of the div linkable.
Without having any code to look at, I would imagine the problem is that you have it set as a block. By definition the block attribute makes the tag it is acting on display the entire width of the parent container. Try changing it to display:inline instead.