CodeVerge.Net Beta
Login Idy
Register Password
  Forgot?
Explore    Item Entry    Members   
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML





Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 1/11/2007 3:21:34 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 16 Views: 19 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
17 Items, 1 Pages 1 |< << Go >> >|
swaino
Asp.Net User
Background-image not displaying in table cell1/11/2007 3:21:34 PM

0/0

Hi,

 I have a problem with displaying a background image in a table cell with repeat x set.

In the CSS I have:

.welcomeHeader
{
    BACKGROUND-IMAGE: url(images/other/shadowheader.jpg);
    BACKGROUND-REPEAT: repeat-x;
    font-size: 16px;
    background-attachment: fixed;
    font-family: Arial, Verdana;
    height: 21px;
    color:Red;
    width: 550px;
}

In the .aspx page I have this:

<table class="welcomeHeader" >

' stuff in the table cell 

</table>

Now when I preview it in VS, it shows the shaded border behind the red text.

However when I run it, no background image appears.  Why does it appear in the preview in VS but NOT in the running version of the app?

This is becoming an annoying 'feature' of VS ASP.NET, things rendering ok so everything looks find and dandy, but you get a nasty surprise when you run it. I feel like I'm developing through trial and error.

The CSS file is stored under MyTheme under App_Themes.

Any help would be appreciated, thanks.


 

ps2goat
Asp.Net User
Re: Background-image not displaying in table cell1/12/2007 2:32:25 AM

0/0

You're putting the style in the table tag. Have you tried putting it in the actual <td> tag? That's what actually holds content...
---------------------------------------
MCP - Web Based Client Development .NET 2.0
tfsmag
Asp.Net User
Re: Background-image not displaying in table cell1/12/2007 4:59:21 PM

0/0

if it's in the table header you might want to use the <th></th> and add that to your style sheet.

.welcomeHeader
{
    font-size: 16px;
    background-attachment: fixed;
    font-family: Arial, Verdana;
    height: 21px;
    color:Red;
    width: 550px;
}

.welcomeHeader th

{

  BACKGROUND-IMAGE: url(images/other/shadowheader.jpg);
    BACKGROUND-REPEAT: repeat-x;

 

then

<table class="welcomeHeader">

<tr><th>content for cell with background</th></tr>

</table>

 You could do the same with the td tag as well.

 Another option would be to just create a class for that background and apply it directly to the th or td tags

 

.bgcell

{

  BACKGROUND-IMAGE: url(images/other/shadowheader.jpg);
    BACKGROUND-REPEAT: repeat-x;

}

<table>

<tr><td class="bgcell">content for cell</td></tr>

</table>

 

hope this helps.

 


------------------------------------------------
Jeff Turner (simpleModus)

Don't forget to mark the correct answer for your
question to help out future visitors!
tfsmag
Asp.Net User
Re: Background-image not displaying in table cell1/12/2007 5:00:27 PM

0/0

oh yeah, don't trust the design view in VS, it's notoriously bad at displaying things as they actually should appear in the browser.  

------------------------------------------------
Jeff Turner (simpleModus)

Don't forget to mark the correct answer for your
question to help out future visitors!
swaino
Asp.Net User
Re: Background-image not displaying in table cell1/15/2007 2:21:18 PM

0/0

Ok thanks for the suggestions.  I'm having problems when i try to put these lines in a class in a CSS file though.

If I specify them inside the 'style' attribute in the designer then the image is repeated ok (although not rendered in the design view, only seen at runtime).

Any ideas? 

ps2goat
Asp.Net User
Re: Background-image not displaying in table cell1/15/2007 3:30:15 PM

0/0

In your original post, you had some styles in the CSS as all upper case; CSS is supposed to be all lower case, so try changing that.  Second, I've had some issues with having background images being 'fixed' in places other than the page background.  Try using 'scroll' instead.

 

Post your CSS and the bit of code that uses it, if this doesn't work.


---------------------------------------
MCP - Web Based Client Development .NET 2.0
Adam.Kahtava
Asp.Net User
Re: Background-image not displaying in table cell1/15/2007 5:26:25 PM

0/0

CSS is NOT case-sensitive, but XML and XHTML are case-sensitive. Mixing uppercase and lowercase in CSS should not be an issue.

All CSS style sheets are case-insensitive, except ... http://www.w3.org/TR/REC-CSS2/syndata.html#q4

I'm echoing what tfsmag said; don't use the Visual Studio Design view, it doesn't display your web design properly.

 

 

 

 


-Adam Kahtava [http://adam.kahtava.com]
ps2goat
Asp.Net User
Re: Background-image not displaying in table cell1/15/2007 7:12:29 PM

0/0

I didn't say CSS was case-sensitive; it's good to stick with the community's convention, though.
---------------------------------------
MCP - Web Based Client Development .NET 2.0
Adam.Kahtava
Asp.Net User
Re: Background-image not displaying in table cell1/15/2007 9:17:54 PM

0/0

It was certainly implied.

Your previous post:

CSS is supposed to be all lower case, so try changing that.


-Adam Kahtava [http://adam.kahtava.com]
tfsmag
Asp.Net User
Re: Background-image not displaying in table cell1/15/2007 11:34:01 PM

0/0

css is case sensitive depending on the browser, no? I could have sworn I had issues with firefox where i had to change the case of a class name to match what was in the css file for it to render correctly in firefox.

 

     


------------------------------------------------
Jeff Turner (simpleModus)

Don't forget to mark the correct answer for your
question to help out future visitors!
tfsmag
Asp.Net User
Re: Background-image not displaying in table cell1/15/2007 11:44:33 PM

0/0

lol, nevermind, i just read the w3 link above and it explains why I had that issue.

------------------------------------------------
Jeff Turner (simpleModus)

Don't forget to mark the correct answer for your
question to help out future visitors!
swaino
Asp.Net User
Re: Background-image not displaying in table cell1/16/2007 4:08:24 PM

0/0

Ok some more info...  The class is as follows (stored in a .css file under the theme directory):

.welcomeHeader
{   
    padding-left:5px;
    font-size: 14px;
    background-attachment: fixed;
    font-family: Arial, Verdana;
    height: 21px;   
    width: 550px;
    text-align:left;
}

.welcomeHeader th

{
    background-image: url(images/other/shadowheader.jpg);
    background-repeat: repeat-x;
    color:Green;
}

I've tried setting both the page stylesheettheme & pagetheme attributes to 'MyTheme' which has the relevant CSS file underneath.
The ASP source looks like this:

<table class="welcomeHeader" style="width: 100%" >
                    <tr>
                        <th  style="width: 546px">
                            <br />
                            Welcome
                            <asp:LoginName ID="LoginName1" runat="server" Font-Bold="True" />
                            &nbsp;(<asp:Label ID="lblUserEmail" runat="server" Text="Users Email"></asp:Label>).&nbsp;
                            Your last visit
                            was at
                            <asp:Label ID="lblLastLogin" runat="server" Font-Bold="True" Text="Last Login"></asp:Label>

                        </th>
                    </tr>
</table>

The correct CSS is obviously being picked up because the font turns GREEN, however absolutely no sign of the background image.

My mind has been boggling me for ages on this.

tfsmag
Asp.Net User
Re: Background-image not displaying in table cell1/16/2007 4:46:27 PM

0/0

where you're calling the image in your css on this line

background-image: url(images/other/shadowheader.jpg);

try including the full path from the root.

background-image: url(/yourappname/images/other/shadowheader.jpg);

 i've had to do this in the past to get something to render correctly.
 


------------------------------------------------
Jeff Turner (simpleModus)

Don't forget to mark the correct answer for your
question to help out future visitors!
Adam.Kahtava
Asp.Net User
Re: Background-image not displaying in table cell1/16/2007 5:04:49 PM

0/0

You may be interested in using Firebug to expedite your debugging process. Firebug lets you click on HTML items on your rendered webpage and view the CSS that has been applied.

you could also try setting:

background-color: blue;

In an effort to test whether your background styles are being applied.


-Adam Kahtava [http://adam.kahtava.com]
ps2goat
Asp.Net User
Re: Background-image not displaying in table cell1/16/2007 6:08:28 PM

0/0

What you need to do is tell the browser where to start tiling the image.  To do this, you need to set background-position:, and if you have an external style sheet, Visual Studio will give you some run-time values (i.e. center), or you can give absolute values.  These values are relative to the upper-left  point of the element, just like when setting absolute positioning for elements on the page.

Instead of declaring each part of the background style individually, you could use the line below (which I used in testing):

background: transparent url(images/other/CheckMark.jpg) repeat-x scroll top top;

(Color, image url, repeat, attachment, position)

 I've had problems in IE and Firefox if I declare 'fixed' on a background image, i.e. IE won't display it; Firefox will, but the image scrolls through as the user scrolls down the page.  I haven't had any problems with scroll.


---------------------------------------
MCP - Web Based Client Development .NET 2.0
Zhao Ji Ma - MS
Asp.Net User
Re: Background-image not displaying in table cell1/23/2007 8:47:48 AM

0/0

This style works for me. 

<style>
.welcomeHeader
{   
    padding-left:5px;
    font-size: 14px;
    background-attachment: fixed;
    font-family: Arial, Verdana;
    height: 21px;   
    width: 550px;
    text-align:left;
    background-image: url(background.jpg);
    ;background-repeat: repeat-x;

}

.welcomeHeader th

{

    color:Green;
}
</style>


Zhao Ji Ma
Sincerely,
Microsoft Online Community Support

?Please remember to click ?Mark as Answer? on the post that helps you, and to click ?Unmark as Answer? if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ?
citizen.i
Asp.Net User
Re: Background-image not displaying in table cell3/30/2007 9:27:09 AM

0/0

Try "../" as a path prefix.

.welcomeHeader
{
    BACKGROUND-IMAGE: url(../images/other/shadowheader.jpg);
...


jbi4-2549-ni1j-moi1-1bnk
17 Items, 1 Pages 1 |< << Go >> >|



Search This Site:


Meet Our Sponsors:



Other Resources:

ng.borland-forums.borland-public-delphi-graphics - Web Programming ... DESIGN TABLE LAYOUT IN RESTAURANT APPLICATION AT RUNTIME. 15. 14. 3/7/2008 3:50:02 PM ... Component to view hotspot image (viewer and hotspot editor) 1. 15. 2 ...
Table background image tiling problem in Netscape ... discipline Netscape and not let it tile your precious background table image? ... Netscape tends to repeat the background image of a table in each table cell. ...
Background table cell image not displaying correctly in Netscape 7.0 ... Background table cell image not displaying correctly in Netscape 7.0 CSS ... Background table cell image not displaying correctly in Netscape 7.0. User Name ...
Discuss HTML and CSS : background image not showing -- urgent This can be simply verified by simply displaying the image :- <table> <tr> <td> ... in the cell would imply that there is no space to display the background image. ...
Adobe - Dreamweaver General Discussion background image not repeating in IE6 - Newsgroup User - 12/26/2006 07:07:10 AM ... I have a background image in a cell of a 1x1 table ...
Webmaster Help - HTML Tips - How To Display Background Images & Colors ... ( and/or in a table data cell ) td background="wall15.gif" Table Example : ... a background color, even in an area where you are displaying a background image. ...
Help talk:Table - Meta 73 CSS style background-image not working inside cell style ... table code in those template files so that they go back to displaying ...


 
All Times Are GMT