Hi all I'm using Google Sites and I want to write a very simple CSS script in my page:

<style>p {background:#ccc;}</style>

However, Google removes all style tags. The solution they provide is to put our styles in an inline attribute as such:

<div style="...">

I've tried this but it doesn't work:

<div style="p {background:#ccc;}">

I was wondering how do we write a CSS "block-level-styles" within an inline style attribute tag?

有帮助吗?

解决方案

You can't. Inline styles can only contain property-value declarations; they can't contain declaration blocks or selectors.

You would have to apply the background:#ccc inline style to all the p elements, unfortunately...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top