Gatsby: [gatsby-source-wordpress] Styling post content

Created on 5 Apr 2019  路  2Comments  路  Source: gatsbyjs/gatsby

How do I style post content?

I'm currently setting
<div dangerouslySetInnerHTML={{ __html: props.pageContext.content }}/>

to dump my conent onto a page. However I'd like to add classes and style the specific pieces of content.

I couldn't find anything in the guidelines.

question or discussion

Most helpful comment

Hey @kostimarko!

Right now we don't have builtin methods for manipulating html content/strings (to add classnames). You can style your content using something like:

<div className="someClassName" dangerouslySetInnerHTML={{ __html: props.pageContext.content }}/>

and target elements with appropiate selectors - i.e.:

.someClassName p {
}

etc

All 2 comments

Hey @kostimarko!

Right now we don't have builtin methods for manipulating html content/strings (to add classnames). You can style your content using something like:

<div className="someClassName" dangerouslySetInnerHTML={{ __html: props.pageContext.content }}/>

and target elements with appropiate selectors - i.e.:

.someClassName p {
}

etc

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KyleAMathews picture KyleAMathews  路  3Comments

theduke picture theduke  路  3Comments

ghost picture ghost  路  3Comments

signalwerk picture signalwerk  路  3Comments

3CordGuy picture 3CordGuy  路  3Comments