Print Style Sheet problem (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


cswolf -> Print Style Sheet problem (1/17/2007 11:24:55)

Hi all,

First off - yes, I have seen the tutorials and FAQ's about the print style sheets at the top of this forum.

I have created a print style sheet for my company's intranet site and for the most part I am happy with it, but it doesn't work 100% correct. I took over managing this site from someone else. The layout was not made with CSS, but rather with tables. I gave a few of the tables some id names and then used CSS to style them. It looks great on the screen, but not for print. The problem I am having is that I cannot for the life of me get the border on this one table to NOT show up for print purposes. Font style and colors are being ignored as well within this table. For the screen, here is my styling of this table:

#myTable {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
border: 1px solid #D7D2C2;
}


Where this table is used in the web page, the html looks like this:

<table width="95%" border="0" align="center" cellpadding="5" cellspacing="5" id="myTable">

Yes, I understand there are some properties there that I could also style with CSS and it is on my "to-do" list but I haven't gotten there yet.

When viewing this on the screen, the table appears in the center of the page, with a 1px grey border around it and then all content goes in the middle with the appropriate font (Verdana) and size (12px), just like it is supposed to.

So then I made a print style sheet in which I defined a class called "noPrint" which I applied to such things as the header and footer of the page, and also told it to display no images. Basically what it does is not display anything except this table and it's contents. I restyled this table in the print style sheet with the following:

#myTable {
font-family: Arial, Helvetica, sans-serif;
font-size: 12pt;
border: none;
width: 7in;
color: #000000;
}


Now here's where it gets confusing - as you can see some things have changed. However the fonts still show up in Verdana and the border still shows around the table. BUT...it is now set to a width of 7 inches so nothing gets cut off when printing. It's almost like it's reading SOME of the print style sheet but not all of it, and I can't figure out for the life of me why. Does anyone have any ideas? Thanks!




Tailslide -> RE: Print Style Sheet problem (1/17/2007 11:31:51)

Forgive me for asking, but are you specifying media=print in the stylesheet link rather than screen or whatever? (I ask 'cos I've done that one myself! [:D]).




cswolf -> RE: Print Style Sheet problem (1/17/2007 11:34:09)

Yes I am. Sorry, I should have mentioned that.




Tailslide -> RE: Print Style Sheet problem (1/17/2007 11:48:56)

No problem.

Tricky... hmmmm.

Can you possibly paste in the HTML page markup and the CSS files (both of them) and then we can test locally to try to figure it out. I'm assuming that we can't get access to it on the open web anywhere?




mtfm -> RE: Print Style Sheet problem (1/17/2007 14:03:10)

usually when I find it is reading some but not all of a stylesheet it is because of a typo-- a misplaced or absent semicolon, or a ( instead of a {, something along those lines.





cswolf -> RE: Print Style Sheet problem (1/17/2007 14:13:15)

Thanks for your help everyone, but I actually figured out what was wrong!

The site was made using Dreamweaver, and some portions of the header/footer were created using the Library feature. I discovered that one of the libraries in use had a link in it to the screen style sheet, so that was overiding the print one because it was further down the page. I removed the link to that screen style sheet in the library file (it wasn't needed) and now it works the way I want it to![:D]




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875