Does putting inline CSS on a heading element such as
<h2> affect SEO? If so, how?
What counts for a search engine is textual content, it will filter out everything else.
In-line CSS will contribute to the payload of the page and that affects the load speed.
Recent SEO tests show that Google doesn't pay much attention to tags anymore. Using
<h1> tags is not really important at all anymore.
Google does give more weight to text that is large bold, above the fold, and centered. IE, text that looks like a heading. Styling your h1 tags such that they don't look like headings is going to be counterproductive. Google is going to treat the text inside an h1 that is styled to look less prominent as if it were not in a heading tag at all.
Conversely, styling a
<div> to look like a heading (big, bold, and prominent) will give the text in it more SEO weight. It doesn't matter if that styling is inline, or done through a linked CSS file.
The main thing is that you should use separate css file for styles that improve your site's load time. On top of that, you can hide your .css from the SE bots whereas any evil inline css you use will be plainly visible to all the bots.
But if you're using nicely, there really is not a big effect on SEO or ranking.
Does putting inline CSS on a heading element such as and affect SEO?
No, but it might slow down the page a notch since you're expecting the web browser to apply a style on-the-fly.
<html> <head> </head> <body> Main content <script> document.getElementsByTagName('H1').style.fontSize="200%"; </script> </body> </html>
It may add a few hundred more bytes to the HTML but at least all the text-based content will load before any styling is applied to it. This means users can see text sooner.