Skip to content

Add vertical-align support for images#54

Closed
andreasisaak wants to merge 3 commits into
necolas:masterfrom
andreasisaak:master
Closed

Add vertical-align support for images#54
andreasisaak wants to merge 3 commits into
necolas:masterfrom
andreasisaak:master

Conversation

@andreasisaak
Copy link
Copy Markdown

Please add the vertical-align to prevent the 1px space at the bottom of images

@aratak
Copy link
Copy Markdown

aratak commented Oct 9, 2011

Why you suggest "middle" as a default? "baseline" is better, imho. What do you think?

@andreasisaak
Copy link
Copy Markdown
Author

The value "middle" is just my taste ;) But i think you are right - "baseline" ist better for a standard css.

@aratak
Copy link
Copy Markdown

aratak commented Oct 9, 2011

Okay. The second my point:
Does some browser haven't "baseline" for images as default value for vertical-align property?

Why you want to add this property?

@andreasisaak
Copy link
Copy Markdown
Author

Because its a well-known bug in IE.

A other solution is to add "display:block" to the images but i think this is to heavy. "vertical-align" is the smarter solution

@andreasisaak
Copy link
Copy Markdown
Author

Sorry but baseline is not the solution!! My fault, it must be either vertical-align: middle or display: block

You can see the testcase here:
http://jsfiddle.net/andreasisaak/GqPQG/

@necolas
Copy link
Copy Markdown
Owner

necolas commented Oct 17, 2011

The space can be removed with various other values for vertical-align as well as applying line-height:0 to the container.

However, vertical-align:baseline is the default in all browsers. I don't think I want to remove the default, expected vertical alignment of images for this scenario.

@andreasisaak
Copy link
Copy Markdown
Author

Yes, but the default dont correct the bug ;)

@necolas
Copy link
Copy Markdown
Owner

necolas commented Oct 17, 2011

It's not a bug.

@andreasisaak
Copy link
Copy Markdown
Author

You think it's not a bug? 3px white space at the bottom of every image?
Please search on google ;)

3px Gap Bug aka Text Jog Bug

@paulirish
Copy link
Copy Markdown

http://jsfiddle.net/GqPQG/4/ is pretty weird to me.
but http://jsfiddle.net/GqPQG/5/ is even weirder.

so i think a default of middle would be bad, even though it makes the img sit nicely in its parent block.

text-bottom is close but not the same as baseline which is widely regarded as the correct interplay between text and img's...

so yeah.

@Yeswanth-JG
Copy link
Copy Markdown

parent-selector {
font-size:0;
}

parent-selector * {
font-size:12px (or some desired value) //this is needed only for text-containers
}

Try the above for removing space in bottom. No need to change default values.

By default, image will have "display:inline-block" and vertical-align:baseline

Repository owner locked and limited conversation to collaborators Mar 30, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants