Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Limiting content width - DIV or BODY?

Reply
Thread Tools

Limiting content width - DIV or BODY?

 
 
Michael Laplante
Guest
Posts: n/a
 
      04-29-2006
I'm trying to produce a "print friendly" version of a page. I used:

<body style="width: 75%; margin-left: auto; margin-right: auto;">

In Netscape and FF, this produced a page with a margin about it nicely
centered on the page.
However, IE's output is clear across the page with no margins.

Best way to solve this problem?

Use a div instead?
Use a table for a brute force method?
Tweak my <body> tag somehow for IE?

I'm relatively new to CSS.

M





 
Reply With Quote
 
 
 
 
BootNic
Guest
Posts: n/a
 
      04-29-2006
> "Michael Laplante" <(E-Mail Removed)> wrote:
> news:qdy4g.2673$Yy5.1872@edtnps89....
>
> I'm trying to produce a "print friendly" version of a page. I used:
>
> <body style="width: 75%; margin-left: auto; margin-right: auto;">
>
> In Netscape and FF, this produced a page with a margin about it
> nicely centered on the page.
> However, IE's output is clear across the page with no margins.
>
> Best way to solve this problem?
>
> Use a div instead?
> Use a table for a brute force method?
> Tweak my <body> tag somehow for IE?
>
> I'm relatively new to CSS.


Are you using any kind of Document Type?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

--
BootNic Saturday, April 29, 2006 2:37 AM

If the facts don't fit the theory, change the facts.
*Albert Einstein *


 
Reply With Quote
 
 
 
 
Toby Inkster
Guest
Posts: n/a
 
      04-29-2006
Michael Laplante wrote:

> I'm trying to produce a "print friendly" version of a page.


Stop trying. Use a print stylesheet instead.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Michael Laplante
Guest
Posts: n/a
 
      04-29-2006
"Toby Inkster" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)5n.co.uk...
> Michael Laplante wrote:


> Stop trying. Use a print stylesheet instead.


Not very helpful, I'm afraid. From:
http://css-discuss.incutio.com/?page=PrintStylesheets
--Quote--
When printing Web documents, margins are set in the browser's Page Setup (or
Print Setup) dialog box. These margin settings, although set within the
browser, are controlled at the operating system/printer driver level and are
not controllable at the HTML/CSS/DOM level. (For CSS-controlled printed page
headers and footers see PrintingHeaders.)
....
When subsequently printing pages, you may find that the top or bottom line
of text is "cut off", or find even worse page-break mangling (see "Page
Breaks" below). If so, slightly increase the top or bottom margin
respectively. Experiments with my own sites suggest that a generous bottom
margin will reduce page-break problems (it forms a kind of overflow area).
However, adjusting margins is under the control of browser users rather than
developers and you can place no reliance on its having been done at all, let
alone well.
In your site's screen stylesheet, you may have chosen to set margins and
padding on the <body> element (browsers set their own default values). If
you have a print stylesheet, you will probably want to set the values for
margin and padding to zero since the user's "print margins", as described
above, must be assumed to be sufficient (and what the user wants).
-- End quote--

So that tells me that a print stylesheet won't necessarily guarantee the
margins I'm looking for. For now, I've used the table "brute force" method
which works in both IE and FF. The CSS equivalent -- to my mind -- would be
a "container" of suitably narrowl fixed width, centered on the page. I
figured that <body> or <div> could be the containers, but apparently it's
not that easy.

If anyone has an elegant -- and relatively simple -- CSS method, please let
me know.

M



 
Reply With Quote
 
kchayka
Guest
Posts: n/a
 
      04-30-2006
Michael Laplante wrote:
> "Toby Inkster" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)5n.co.uk...
>> Michael Laplante wrote:

>
>> Stop trying. Use a print stylesheet instead.

>
> Not very helpful, I'm afraid. From:
> http://css-discuss.incutio.com/?page=PrintStylesheets


Hmmm... That article was written 3 years ago. Browsers change, except
for IE, anyway. FWIW, I use print stylesheets all the time and
rarely have a problem with them.

> So that tells me that a print stylesheet won't necessarily guarantee the
> margins I'm looking for.


Why do you need specific margins? If you are trying to print something
like a form, you may be much better off providing the print version as
a PDF instead.

> For now, I've used the table "brute force" method
> which works in both IE and FF.


For some value of "works", I'm sure. :-\

You've decided on the solution without properly identifying the
problem, so the answer may not be what you think. Post a URL, so we
can see what you're on about.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
 
Reply With Quote
 
Michael Laplante
Guest
Posts: n/a
 
      05-01-2006
"kchayka" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Michael Laplante wrote:


> Why do you need specific margins? If you are trying to print something
> like a form, you may be much better off providing the print version as
> a PDF instead.


I never said I needed specific margins or even margins at all. I simply want
some sort of margin to make the printed output more visually appealing to
the end user. I simply wanted to know why my one line CSS solution didn't
work and what SIMPLE alternatives existed.

>> For now, I've used the table "brute force" method
>> which works in both IE and FF.

>
> For some value of "works", I'm sure. :-\


??

> You've decided on the solution without properly identifying the
> problem


I would think that I'm the best person to identify my problem, doncha think?
By presuming to identify my problem, you've made some incorrect assumptions
about the situation. That, in turn, led you to propose a solution that has
nothing to do with what I am trying to accomplish.

However, if you re-read my original post, you could help me with a SOLUTION
to the problem as I identified it.

FWIW, a sample page is here:
http://www.bcfirstaid.com/adult.htm

Halfway down you see a link to a print version. Right now I've used "brute
force" technique -- a single cell table of fixed width that produces the
same output in IE, FF and Netscape. Unsophisticated but entirely sufficient
with only six simple tags required.

Print stylesheets have some merit, but aren't without their own issues. Can
you propose a simpler technique? Can you tell me why my original solution
wouldn't work? I look forward to your reply.

M


 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      05-01-2006
Deciding to do something for the good of humanity, Michael Laplante
<(E-Mail Removed)> declared in alt.html:

> I never said I needed specific margins or even margins at all.


Yes you did:

> So that tells me that a print stylesheet won't necessarily guarantee the
> margins I'm looking for.


Message-id: <xwS4g.2134$cZ3.1371@clgrps13>

> I simply want
> some sort of margin to make the printed output more visually appealing to
> the end user.


See? You said it again.

> I simply wanted to know why my one line CSS solution didn't
> work and what SIMPLE alternatives existed.


Get rid of all that absolute positioning. You're making it far more
complicated than it needs to be.

> I would think that I'm the best person to identify my problem, doncha think?


Not necessarily. Given the evidence available, I'd say certainly not.

> By presuming to identify my problem, you've made some incorrect assumptions
> about the situation.


Only because you didn't provide enough information in the first place,
namely a URL.

> FWIW, a sample page is here:
> http://www.bcfirstaid.com/adult.htm


As I said above, most likely it's all the absolute positioning that's
causing problems.

> Print stylesheets have some merit, but aren't without their own issues.


Such as? I haven't ever had problems with them.

--
Mark Parnell
My Usenet is improved; yours could be too:
http://blinkynet.net/comp/uip5.html
 
Reply With Quote
 
Michael Laplante
Guest
Posts: n/a
 
      05-01-2006
"Mark Parnell" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Deciding to do something for the good of humanity, Michael Laplante
> <(E-Mail Removed)> declared in alt.html:
>
>> I never said I needed specific margins or even margins at all.

>
> Yes you did:


>> I simply wanted to know why my one line CSS solution didn't
>> work and what SIMPLE alternatives existed.

>
> Get rid of all that absolute positioning. You're making it far more
> complicated than it needs to be.


How so? Why does absolute positioning make it complicated? What would you do
to "simplify it?" How does this relate to my wanting (not needing) a margin
for aesthetic purposes?

>> I would think that I'm the best person to identify my problem, doncha
>> think?

>
> Not necessarily. Given the evidence available, I'd say certainly not.


Do you have a solution or not?

>
>> By presuming to identify my problem, you've made some incorrect
>> assumptions
>> about the situation.

>
> Only because you didn't provide enough information in the first place,
> namely a URL.
>
>> FWIW, a sample page is here:
>> http://www.bcfirstaid.com/adult.htm

>
> As I said above, most likely it's all the absolute positioning that's
> causing problems.


"Most likely?" So you aren't sure? Should I use relative positioning? Will
that give me margins with my original body tag?
>
>> Print stylesheets have some merit, but aren't without their own issues.


> Such as? I haven't ever had problems with them.


A printsheet is a SIMPLE CSS solution to my margins issue? Can you point me
to a sample of one of your print stylesheets that would give me margins.

Aside from vague comments and guesses you haven't demonstrated any depth of
knowledge here. Are you considered one of the experts in this ng?

Please go "help" someone else. . .



 
Reply With Quote
 
Michael Laplante
Guest
Posts: n/a
 
      05-01-2006
"BootNic" <(E-Mail Removed)> wrote in message
news:tRD4g.5384$(E-Mail Removed) t...
> "Michael Laplante" <(E-Mail Removed)> wrote:
> news:qdy4g.2673$Yy5.1872@edtnps89....


Are you using any kind of Document Type?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

Thanks. Tried it but in IE it still prints from edge to edge unless I use
printer setup to set margins.

M


 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      05-01-2006
Deciding to do something for the good of humanity, Michael Laplante
<(E-Mail Removed)> declared in alt.html:

> Please go "help" someone else. . .


As you wish.

--
Mark Parnell
My Usenet is improved; yours could be too:
http://blinkynet.net/comp/uip5.html
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
6500: User-Based Rate Limiting AND Total Rate Limiting Patrick Cervicek Cisco 0 08-07-2007 03:07 PM
set div width to remaining width of the browser Steve Richter ASP .Net 2 06-15-2007 06:40 PM
how to: div width = browser.width? =?Utf-8?B?cm9kY2hhcg==?= ASP .Net 3 10-30-2006 05:43 AM
Cell width error when containing variable width content mj.redfox.mj@gmail.com HTML 0 01-26-2006 03:37 PM
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM



Advertisments