Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <blockquote> style Attribute

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.

Example

#

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>

Using style

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.


Syntax

<blockquote style="CSS-styles">

Values

#

Value Description
CSS-styles One or more CSS property/value pairs separated by semicolons (;).

More Examples

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>

Code explanation

The style attribute assigns a border color to the <blockquote> element.

Clicking the button calls JavaScript which toggles the border to another color.


Browser support

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

You may also like

 Back to <blockquote>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides