Vertical alignment floater div method not working - html

I am trying to implement the floater div (http://www.vanseodesign.com/css/vertical-centering/) method of vertically centring a h2. It doesn't work with the markup I have (see example below):
http://jsfiddle.net/brendan_rice/LCP5K/1/
Can anyone see where I am going wrong?

I don't really understand if you were trying to put that text box in the centered div or not , you didn't have it that way in your html, THis is an example of how to center with the method you were talking about , although there are much better ways , that is probably why this one was the last option of those examples in that link jsfiddle

Related

Align content horizontally next to div using flexbox

I'm relatively new to HTML and CSS and am trying to use CSS flexbox to align two divs horizontally instead of it positioning the second div underneath the first or just having the second one just hide behind the first one.
I've tried answers from
this question and many others that all suggested to use justify-content to horizontally align the content but it's just not working for me. Here is the code that I'm struggling with.
Any help is greatly appreciated!
Many thanks,
Michael
EDIT:
Sorry for the confusion, to clarify, what I want is the text aligned horizontally to the right of the other div coloured grey. I should also say that I have tried using float with no success.
just add this float:left; to sidebar class style . after this two div align horizontally ,if i understand what you need to achieve.

Why won't this parent div respect the height (with padding) of its children?

I want to create a button/link that is centered in the content area of a webpage. Because it's a button, and not just a link, I'm adding some padding and background colour to it.
The link is centered horizontally, but the padding seems to expand outside the line-height of the parent element, causing it to overlap with previous/next elements. See: http://fths.convoke.info/what-can-i-do/
I tried creating a fiddle, but wasn't seeing the same issue: http://jsfiddle.net/convoke/g9wu6ws9/
So what am I missing? Conversely, is there a better way to center a link like this? I don't like using margin: auto because it requires you specify the width. Ideally the width would be dynamic, so if the text on the button was longer or shorter, it would remain centered.
In this case, the answer I needed came from user #CBroe in the comments of my original question. He suggested using display:inline-block and that worked like a charm.
Still unsure as to why I was getting different results on the fiddle vs the actual website...

Why float left doesn't work

I'm building a website with fluid layout and I want avoid things like setting dimensions. I'm having success in almost everything, but I have a div that doesn't work as expected. See this link: http://cssdesk.com/Bshqe.
I expect that "div_botao_comecar_convite_cadastro_b" were placed to the right of "div_descricao_curta_convite_cadastro_b", but it was placed below this div. I want that the div be placed at left.
As I say, I don't want set a width for anyone div. Sorry for bad english. Thanks in advance.
If you don't want to set a specific width but want the children elements aligned horizontally, use css3 flexboxes -
apply display:flex to #div_elementos_convite_cadastro_b and adjust the other css accordingly....
demo
more about flexboxes # CSSTricks

Force vertical alignment despite lack of text?

I would like to vertically center a display:inline-block element with vertical-align:middle. The problem is that it doesn't vertically align in the absolute center until the text reaches that point.
See: http://jsbin.com/afojew/1/edit
This works, but is a bit hacky: http://jsbin.com/afojew/2/edit
edit: ^ that doesn't quite work, but this does: http://jsbin.com/afojew/3/edit
This has been asked before - Ive just read it and it contains pretty much everything you would need to know with this problem : Vertically align text in a div

CSS/HTML: element that is centered wont center right

If you check this:
http://jsfiddle.net/QbMmX/1/
Then you can see that the box(div element) is moving more at the left than the text. It doesnt get center like the text does. Why is this occuring and how can i fix this?
#recentStatus is centering as you're expecting as a result of its display: inline style.
So if you add display: inline-block to .userStatusComment, it'll center similarly to the other elements.
Take a look at this modified version of jsfiddle:
http://jsfiddle.net/QbMmX/4/
I have added a background-color to both the right and left elements to help you visualize the result and reason why the centering was not happening the way you wanted. This seems to work in chrome.
Hope this helps.
Bob