Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why are <img> elements given display: table;? #29

Closed
6twenty opened this issue Jun 7, 2016 · 3 comments
Closed

Why are <img> elements given display: table;? #29

6twenty opened this issue Jun 7, 2016 · 3 comments

Comments

@6twenty
Copy link

6twenty commented Jun 7, 2016

On one hand I'm just curious what the design choice here was about; on the other hand there's an issue when there's an <img> element within a container with .ta-center/.ta-right -- the image won't respect the text alignment. This can be worked around however by setting appropriate margins on the image:

.ta-center img {
  margin-left: auto;
  margin-right: auto;
}

.ta-right img {
  margin-left: auto;
}
@tylerchilds
Copy link
Owner

The only real reason was for chopping off the ghost pixels (~4px) below the image to get it to fall perfectly on the baseline grid for vertical rhythm. I don't think it's something worth working around, I just didn't see the negative consequences at the time.

I'll make sure this gets resolved so images display as expected by default.

@abdobouna
Copy link

I think the problem is due to the display of the <img> which is set to inline by default, that makes it inherit the line-height of the parent container, thus setting the container to line-height: 1 effectively gets rid of the spacing, another method would be to give the <img> a display: inline-block or block which also gets rid of the line-height / spacing problem.

@tylerchilds
Copy link
Owner

resolved in version 2.

display: inline-block;
vertical-align: top;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants