A style attribute on a <blockquote> tag assigns a unique style to the quote.
Its value is CSS that defines the appearance of the quote.
A style attribute on a <blockquote> tag.
And so, my fellow Americans: ask not what your country can do for you – ask what you can do for your country. My fellow citizens of the world: ask not what America will do for you, but what together we can do for the freedom of man.-- President Kennedy, 1961, Inaugural address
<acticle>
<blockquote style="border:dashed 3px plum; padding:20px;">
And so, my fellow Americans: ask not what your country
can do for you – ask what you can do for your country.
My fellow citizens of the world: ask not what America
will do for you, but what together we can do for the
freedom of man.
</blockquote>
-- President Kennedy, 1961, Inaugural address
</article>
The style attribute specifies the style, i.e. look and feel, of the <blockquote> element.
A style contains any number of CSS property/value pairs, separated by semicolons (;).
The style attribute overrides any other style that was defined in a <style> tag or an external CSS file.
This inline styling affects the current <blockquote> element only.
<blockquote style="CSS-styles">
Value | Description |
---|---|
CSS-styles | One or more CSS property/value pairs separated by semicolons (;). |
A style attribute on a <blockquote> tag.
Clicking the button toggles the border color.
And so, my fellow Americans: ask not what your country can do for you – ask what you can do for your country. My fellow citizens of the world: ask not what America will do for you, but what together we can do for the freedom of man.-- President Kennedy, 1961, Inaugural address
<acticle>
<blockquote style="border:dashed 3px teal; padding:20px;"
id="kennedyquote">
And so, my fellow Americans: ask not what your country
can do for you – ask what you can do for your country.
My fellow citizens of the world: ask not what America
will do for you, but what together we can do for the
freedom of man.
</blockquote>
-- President Kennedy, 1961, Inaugural address
</article>
<br /><br />
<button onclick="toggle();">Toggle style</button>
<script>
let toggle = () => {
let element = document.getElementById("kennedyquote");
if (element.style.borderColor === "teal") {
element.style.borderColor = "orangered";
} else {
element.style.borderColor = "teal";
}
}
</script>
The style attribute assigns a border color to the <blockquote> element.
Clicking the button calls JavaScript which toggles the border to another color.
Here is when style support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |
Back to <blockquote>