Avatar of aguisa
aguisaFlag for Costa Rica asked on

form layout on IE and Firefox

Good afternoon.

I have a report that I created in PHP, its layout works perfectly when printed from IE, but when I print it in Mozilla, it prints in a different way.

How can I make that both printings come out the same way, so I can print this form independent from the Browser that the final user chooses.

I know this could be resolved with CSS, divs and font, and styles but I need the precise example please.

thanks as always experts.
HTMLCSS

Avatar of undefined
Last Comment
s8web

8/22/2022 - Mon
ASKER
aguisa

just for example purposes, I would like a code that prints a form with the following elements:

1. Top Left: HELLO

2: Center Middle: GOOD MORNING

3: Bottom RIGHT: GOOD BYE


If I print one page in IE and the other in Firefox, I want the layout to be the same.

thanks again.
ASKER
aguisa

If I put both sheets of papers against white light, I could then be able to make an exact match of both printings when put one on the other.
CCSOFlag

The problem is margins from the browser itself.  You can't change what the margins are on the browsers.  People can make them what they want.

On that note, to make page layouts the same, you will need to specify positioning and margins/padding.

For example the body is treated different within browsers.  To remedy this you can put this in your code:

*
{
margin: 0;
padding: 0;
}

As far as positioning, you will need to absolute position things:
#TopLeft
{
position: absolute;
left: 0px;
top:0px;
}

#CenterMiddle
{
position: absolute;
left: 400px;
top: 400px;
}

#BottomRight
{
left: 800px
top: 800px;
}

The reason is browser interpret positioning different unless you specify exact pixels.  Even then it'll get jacked up if you do not reset the margins and padding for all elements.  IE is known for adding margins/padding when not told to.  It's just how it works.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
Dave Baldwin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
s8web

I agree, there will be no exact in this case. Close, yes. You need a print stylesheet. This is easier than you think. Can you provide a link to the page? If not, provide your browser output (browser parsed page).