Results 1 to 4 of 4

Thread: applying code from stylesheet in style attribute

  1. #1
    Join Date
    May 2007
    Posts
    31
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default applying code from stylesheet in style attribute

    ok i have a div with css styling using the class attribute works fine. it references a class within a separate css stylesheet linked to the file, and all is well.

    now i want to change some of that information with ajax, so i need to take the code from the stylesheet and put in in the page itself. so i copy the code, and use the style attribute instead of class. makes sense to me, however i'm obviously the only one that makes sense to... it's all jacked up, not even close.

    how do i fix this? why is it different using the exact some code?

    here's my code using the class attribute...

    css -
    .leftEdge {background:#000000 url(whatever.gif) repeat-y left top}

    html-
    <div class="leftEdge">

    ...that works fine, why doesn't this....

    no css stylesheet

    html-
    <div style="background:#000000 url(whatever.gif) repeat-y left top">

    i even tried to label everything, using background-repeat and background-position... still a no go. please help

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    that appears to be correct, but if you have your website live, could you give us the url so we can check it out? thanks

    also remember when posting computer code to wrap it in [code][/code] tags

  3. #3
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    is whatever.gif in the same directory as the page you're trying to use it on?

    I know that seems simple but if you had it working in the external CSS, it makes me think that the relative path to whatever.gif isn't the same from your external CSS to the page you're adding it on.

  4. #4
    Join Date
    Oct 2007
    Posts
    43
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ahs10 View Post
    <div style="background:#000000 url(whatever.gif) repeat-y left top">
    Try
    Code:
    <div style="background-color:#000000; background-image:url(whatever.gif); background-repeat:repeat-y; background-position:left top;">

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •