Forum Moderators: not2easy
Im trying to put two backgrounds in the single cell. One background aligns to the left and the other to the right and spans across the Y-axis only at 100%. TO make this seemless i put in a bgcolor which "joins" these two images together. The result, i have a seemless background that can be stretched over any width and height and still remains seemless....
But my question is, how do i get two backgrounds in a single cell? My css so far is below::
.bgall1 {height: 100%; background: 6E6E6E url("../images/NG-MAINLEFTSTRETCH.jpg") repeat-y top left;}
.bgall2 {height: 100%; background: 6E6E6E url("../images/NG-MAINRIGHTSTRETCH.jpg") repeat-y top right;}
My HTML code where i need the background stuff is::
<td colspan="3" height="100%" valign="top" rowspan="2">
Any Help is appreciated =)
Im trying to find a way with DIV tags, but no luck so far....
So here is a good way to fake it using divs..
html:
<div class="outer">
<div class="inner">
<h1>Hello World</h1>
<p>
blah blah blah blah..
</p>
</div>
</div>
As you can see the content appears within two divs, an outer and an inner. Now we can set one part of the background on each div.
CSS:
.outer {
background: #666 url(graphic.gif) repeat-y top left;
padding-left: 50px;
}
.inner {
background: #666 url(graphic.gif) repeat-y top right;
padding-right: 50px;
}
The outer div contains the left border and places 50 pixels of left padding for the border to appear in. Likewise the inner div displays the right border and pads the right.
Adjust the padding to suit the width of your graphic.
Except this one.....
With the div tags do i put them in or outside the cell?
because when i put them in the cell it doesnt span right to the bottom, like the <td class="outer"> does....
I havent even tried out the double backgrounds with the DIVS yet, thought i would ask how to use them in my situation first,
With the div tags do i put them in or outside the cell?
Neither. Just don't use a table for the layout at all if you can avoid it.
If you must place them in a cell then the cell will replace the 'outer' div and you will only need the inner div.
Currently the divs are set to expand around the text that they contain. If you want them to be bigger you may need to put
height:100% back in there.
the solution you say, padding?
I have tried padding, but it only pushes the actual objects out, and not the background itself...if there anyway to position the background images?
thank you again
e.g. the first line of your code should be...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Or one of the other doctypes from the W3C Valid Doctype list [w3.org]
This will put IE into 'standards compliant' mode and it should render the page more like a 'proper' browser (such as Opera).
It will also let you check your code for errors using the W3C HTML Validator [validator.w3.org]
In the example, it is being used to create a rounded tab effect using 2 curved images. You could probably apply the same technique. one image applied against the table cell, the other against a tag inside the cell, <p> for example.