Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8135927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:34:59+00:00 2026-06-06T10:34:59+00:00

I am new to Raphael and am trying to do something very simple, but

  • 0

I am new to Raphael and am trying to do something very simple, but failing miserably. Does anyone know how to create a Raphael canvas and set the background color (ex: green)? This is what I have so far, but when I open it in a browser it displays nothing….

<html>
<head><title></title>
<script src="raphael-min.js"></script>
</head>

<body>

<script type="text/javascript">
//all your javascript goes here

var paper = Raphael(15,40,320,300);

</script>

</body>
</html>

When I put this code inside the js script it displays a circle correctly…

var circle = paper.circle(50,10,10);
circle.attr("fill","#0f0");

But again, my issue is trying to set the background color. Any help would be appreciated.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T10:35:00+00:00Added an answer on June 6, 2026 at 10:35 am

    RaphaelJS doesn’t provide a default background styling, since its event system relies on being object-driven. However, you can designate a particular DIV and style it accordingly:

    <div 
        id="my_paper_div" 
        style="background-color:limegreen;width:400px;height:400px"
    ></div>
    

    Make sure you don’t call either the DIV or variable paper. Give them different names, otherwise you’ll run into some IE incompatibility.

    Redeclare your paper javascript like so:

    // declare outside the startup scope, so you can do fancy things later
    var my_paper;
    
    // raphaeljs' version of onload
    Raphael( function() {
        my_paper = Raphael("my_paper_div", 400, 400);
    });
    

    Since RaphaelJS rendering doesn’t interfere with the background, you can technically mix and match HTML and SVG/VML. For example, see this jsfiddle: http://jsfiddle.net/NQtU5/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to Raphael and am trying to do something very simple, but
Very new to using Raphael.js I'm looking at the tutorials and I am able
new to c#. I'm trying to make a simple system where I can search
I'm trying to create an animation where I create 4 circles in Raphael 10
I'm trying to create an image animation using Raphael JS. I want the effect
Okay so I know the title is very vague but here is my more
I have a set of animated Raphael SVG elements. I am adding new elements
I'm trying to adapt some code from a simple app that uses Raphael to
Im new to Rapahel and im trying to get the position of an element
New to Node.js and Express, I am trying to understand the two seems overlapping

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.