Home Ask Login Register

Developers Planet

Your answer is one click away!

Ram February 2016

two equal width div in html

I have a page that contain the following code

 <div class="op">.....content.......</div>
 <div class="op">.....content.......</div>

i am going to print this page in a4 sheet , but when i print this it is not adjusted equally with paper size .Each div have same content ,they just repeating .I need to make them fit in to the paper .So that i can cut the paper by 2, so that they both have same width .Please help


user2584538 February 2016

Use separate stylesheet for print styles.

<link rel="stylesheet" type="text/css" media="print, handheld" href="foo.css">

So, you can add styles which affect only for printing.

sinto February 2016

try this:

<div style="width:50%; float:left">content</div>
<div style="width:50%; float:left">content</div>

Saad Mirza February 2016

Show Your CSS After addin CSS ,place the first div width 50% and 2nd also 50% and make them both float left.

For Example:


mina a.beigi February 2016

Its aboute your printer setting! Not about css or html. you must set your printer setting to fit the code for paper size. If you want print html final page (result of your code) maybe you code take apart with setting width:50% .i offering you to check your printer setting or system perinting setting for html pages.

Post Status

Asked in February 2016
Viewed 3,985 times
Voted 10
Answered 4 times


Leave an answer

Quote of the day: live life