Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

Declare gradient in CSS and link it to RECT

abdelkader_l_
Beginner
631 Views

I declared in CSS this:

rect#LnGradient1 {
      background: red; /* For browsers that do not support gradients */
     /* Safari 5.1 to 6.0 */
    background: -webkit-repeating-linear-gradient(red, yellow 10%, green 20%);
    /* Opera 11.1 to 12.0 */
    background: -o-repeating-linear-gradient(red, yellow 10%, green 20%);
    /* Firefox 3.6 to 15 */
    background: -moz-repeating-linear-gradient(red, yellow 10%, green 20%);
    /* Standard syntax */
   background: repeating-linear-gradient(red, yellow 10%, green 20%);
}

and in index.html I declared this in head:

 <link rel="stylesheet" type="text/css" href="css/gradient.css">

and this:

  <g>
    <rect x="5" y="3" width="1490" height="160" fill="url(#LnGradient1)" stroke-width="3"
          stroke="rgb(255,0,0)"  />
  </g>

can someone tell me why it does not fill the rectangle with color. Thanks.

0 Kudos
2 Replies
abdelkader_l_
Beginner
631 Views

I am developing new game using HTML5, CSS and JAVASCRIPT in blank project with CORDOVA plugins.

0 Kudos
Chris_P_Intel
Employee
631 Views

Your CSS declaration (rect#LnGradient) says that the gradient should be applied to a rect with the id of LnGradient.  But your rect doesn't have an id.

You can remove the "#LnGradient" part of your declaration.

Or you can add id="LnGradient" to the rect.

0 Kudos
Reply