Coder Social home page Coder Social logo

Comments (9)

jgthms avatar jgthms commented on June 14, 2024 2

Having img { display: block;} is way too opinionated, and will cause lots of problems. Images are considered inline content, although they have a width and a height. You can also put several of them on a singe line. I want to keep that default behaviour as much as possible.

Adding a vertical-align: top could be possible, but trigger other problems.

from minireset.css.

thomasdigby avatar thomasdigby commented on June 14, 2024 2

vertical-align: text-bottom might be the closest match to the default baseline property without rendering the space underneath. https://developer.mozilla.org/en/docs/Web/CSS/vertical-align

from minireset.css.

jgthms avatar jgthms commented on June 14, 2024 2

Looks like a good candidate.

from minireset.css.

lukasoppermann avatar lukasoppermann commented on June 14, 2024 1

@jgthms could you implement it or would you accept a PR?

from minireset.css.

thomasdigby avatar thomasdigby commented on June 14, 2024

I think this issue can be avoided with any vertical-align property, try vertical-align: middle;

from minireset.css.

lukasoppermann avatar lukasoppermann commented on June 14, 2024

But I still think something like this should be included. Anything that removes this weird issue is fine.

from minireset.css.

lukasoppermann avatar lukasoppermann commented on June 14, 2024

Hmm, I do understand that img { display: block;} is to opinionated, but I feel providing an out of the box solution, whatever you would choose for it, would be good.

from minireset.css.

thomasdigby avatar thomasdigby commented on June 14, 2024

Harry Roberts uses a vertical-align in his discovr repo, I think it's fairly safe to use in this context. https://github.com/thomasdigby/discovr/blob/master/css/elements/_elements.images.scss

from minireset.css.

jgthms avatar jgthms commented on June 14, 2024

vertical-align: middle is not a good option as it breaks the natural flow of a paragraph of text:

screen shot 2016-09-11 at 22 18 11

The only options that would both remove the space at the bottom and leave an image readable in a block of text are:

vertical-align: sub;
vertical-align: text-bottom;
vertical-align: bottom;

Not sure what option is the best.

from minireset.css.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.