SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru
    Join Date
    Jul 2002
    Location
    space
    Posts
    845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is this possible?

    Hello,

    My style sheet has the following:

    .back1 {
    background: url(back1.gif) repeat-y right;
    }
    .back2 {
    background: url(back2.gif) repeat-y left;
    }

    I want to call both of these from the same table cell, so that I have one right-aligned background, and one left-aligned background, both in the same cell. How can I go about doing this? From my understanding I can only use one class per cell, IE:

    <td class="back2"></td>

    How can I get both of these in the same cell?

    Thanks.

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't use more than one background image for a single element in CSS2. It will probably be possible in CSS3.

    You can use a DIV as the only child of the cell and move the other content into that. Then assign one background for the cell and the other one for the DIV.

    What kind of data needs two backgrounds, though? (I'm assuming it's data, since you're using a table to display it.)
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Guru
    Join Date
    Jul 2002
    Location
    space
    Posts
    845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I'm trying to do is, inside one table cell, I want to have a background which is defined by a class. (the background is right-aligned) This part is done.

    IE. <td class=""></td>

    But, also, inside the cell, I want to have an image that is left-aligned, and appears at the very top. How do I do this with div?

  4. #4
    Non-Member deathshadow's Avatar
    Join Date
    Jul 2006
    Location
    Dublin, NH
    Posts
    901
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Question: is the cell going to be dynamic or fixed in size? If you are fixing the cell size, just put a DIV inside it set to display:block and the same size, and put the cell data inside the DIV.

    Of course, that only works if there's no cell margins or padding.

  5. #5
    SitePoint Guru
    Join Date
    Jul 2002
    Location
    space
    Posts
    845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello, the cell has a width of 10%, with no spacing or padding. What would be the <div> code for this? I must also add that there is another image inside the cell, that is centered.

  6. #6
    SitePoint Guru
    Join Date
    Jul 2002
    Location
    space
    Posts
    845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    problem solved, n/m


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
  •