C INLINE STYLE PROBLEM

5 replies
  • WEB DESIGN
  • |
OK this is one of those things that drives me crazy because I can't find or see anything wrong with it so maybe it's one of those particulars I've never run into before and so I just don't know about. I've got this CSS /style that isn't working as I would expect. It works fine from the stylesheet. but absolutely will not work from an inline style. in other words this works just fine
Code:
.optin
{
 float:left;
 width:250px;
 height:250px;
 border:1px solid #000;
 background-image:url("../images/formbackground.png");
 background-repeat:no-repeat;
}

But this just simply will not work
Code:
<divstyle="float:left; width:250px;height:250px;border:1px solid #000;background-image:url("./images/formbackground.png");background-repeat:no-repeat;">

And the error it throws /flags is on the background-image:url("./images/formbackground.png")
portion of the style rule it says ...

This attribute name must be followed by an equal (=) sign and a value. If the value is in quotation marks, the quotation marks must match. I want it to work from an inline style so I can apply it to a post without making additions to my Wordpress style.css file Because it gets wiped every time I update Wp
#inline #problem #style
  • Profile picture of the author smitor
    You have to put a space between "div" and "style"...
    Signature
    SiteHost.com - Professional Web Hosting for only $2.95, use coupon code "GETONLINE" at checkout!
    {{ DiscussionBoard.errors[6995988].message }}
    • Profile picture of the author ronc0011
      Originally Posted by smitor View Post

      You have to put a space between "div" and "style"...

      OK this is just something the Warrior forum code does for some reason when I cut and paste code from my editor it takes the space out and if I don't catch it, It gets into my post. So anyway there is a space in the actual code
      {{ DiscussionBoard.errors[6997061].message }}
  • Profile picture of the author smitor
    and use "background: url(./images/formbackground.png) no-repeat;" instead -> a shorthand method. i think the problem is because you have a quotation mark inside a quotation mark and it expects an equal sign before the quotation mark in url("") of style="", you can either remove the quotation mark in the url or replace it with a single quotation.. i hope this helps..
    Signature
    SiteHost.com - Professional Web Hosting for only $2.95, use coupon code "GETONLINE" at checkout!
    {{ DiscussionBoard.errors[6995999].message }}
    • Profile picture of the author ronc0011
      Originally Posted by smitor View Post

      and use "background: url(./images/formbackground.png) no-repeat;" instead -> a shorthand method. i think the problem is because you have a quotation mark inside a quotation mark and it expects an equal sign before the quotation mark in url("") of style="", you can either remove the quotation mark in the url or replace it with a single quotation.. i hope this helps..

      Yep that was it thank you that was driving me nuts I kept looking at it and looking and I just couldn't see it and Google wasn't helping much either
      {{ DiscussionBoard.errors[6997103].message }}
  • Profile picture of the author jamaks
    Hi, I think it would be a case of placing the div inside of a holding div and then giving a full style block
    Code:
    <div id="mydiv"><style type="text/css">#mydiv{float:left;width:250px;height:250px;border:1px solid #000000;background-image:url(../images/formbackground.png);background:repeat:no-repeat;}</style>*Content goes here*</div>
    Certainly this works local but I have not tried it live. Jim
    {{ DiscussionBoard.errors[6996684].message }}

Trending Topics