Git Product home page Git Product logo

Comments (8)

DamianPereira avatar DamianPereira commented on May 25, 2024 4

Is there any documentation on what typography.css styles apart from text elements? I've just checked and it seems to reset lots of element's margin/padding to 0 except for margin-bottom which is set to 1.45rem. Elements like form, address and so are styled. What's the reasoning for this? It seems arbitrary and breaks my layout.

I did not expect img styling at all, and I had to search for a while before I found where the margin-bottom was coming from (suspected font awesome CSS, or normalize, but not typography).

from typography.js.

alexanderzone avatar alexanderzone commented on May 25, 2024 4

This issue is coming up on Google so I wanted to post the solution:

When you intialize the Typography.js object you can provide overrideStyles

new Typography({
  overrideStyles: ({ rhythm }) => ({
    img: {
        marginBottom: 0
      }
  })
})

https://kyleamathews.github.io/typography.js/

from typography.js.

dardub avatar dardub commented on May 25, 2024

Is there a way to turn off this margin and max-width: 100% in the config?

I could only see setting this globally for all images in blogs. On other sites it interferes when trying to use image as style elements.

img {
  max-width: none !important;
  margin-bottom: 0 !important;
}

But I think this could lead to flakey behavior.

from typography.js.

dardub avatar dardub commented on May 25, 2024

Well !important isn't necessary if TypographyStyle is declared before other styles. I swear before the typography style was overriding my webpack loaded styles. But able to reproduce now.

from typography.js.

lobobabysaurus avatar lobobabysaurus commented on May 25, 2024

I'm dealing with the same problem where I wanted consistent text styling but it made my images super small with a bunch of padding in the process. Is there any clean way to disable the way it overrides image css while still getting consistent text formatting benefits?

from typography.js.

rykener avatar rykener commented on May 25, 2024

The documentation doesn't mention this though, so how are we supposed to figure this out? @KyleAMathews

from typography.js.

don-esteban avatar don-esteban commented on May 25, 2024

I'll hook on this post and refer to the solution of @aamistak. As I understand, Typography defines some default rules for tables. One is: td {text-align: left}. In Markdown we can specify cell alignments with colons (:). |---:| means right align. The Markdown-Plugin generates something like this <td align="right">100</td>.

This won't work due to Typographies inline style td {text-align: left}. Overriding won't help either. I should completely remove this style rule.

Is there a way I can do that? I would need something like this (pseudo code)

new Typography({
  overrideStyles: ({ rhythm }) => ({
    td: {
        textAlign: false|null // something to remove the complete rule.
      }
  })
})

from typography.js.

don-esteban avatar don-esteban commented on May 25, 2024

Found this issue and a workaround. #244 (comment)

It's exactly I was talking about. This will result in a feature request to allow removing rules.

from typography.js.

Related Issues (20)

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.