Jump to content

Font size & orientation ignored in HTML code


Go to solution Solved by rocky48,

Recommended Posts

I am extracting a string from a MySQL database using a PHP script to query the database and within this PHP code embeded in it is some HTML code to display and print it out.

 

It is important where it is printed on the sheet of paper, so I have written some CSS code to control its position size and orientation.

 

The code recognises the Font face, but ignores the size I have specified.  Also I need to set the paper orientation but it ignores this as well.

 

I am not sure about the syntax in the HTML code for the orientation.

 

Can anyone help me?

 

CSS script:

/*--Print stylesheet*/

.cc01               { /* Common */
font            : 24px 'French Script MT';
color           : #000000;
}
@page port {size: portrait;margin: 0cm}
@page land {size: landscape;margin: 0cm}
div#Text              { /* <DIV>Text</DIV> */
position        : absolute;
left            : 0.8cm;
top             : 13.5cm;
width           : 10.0cm;
height          : 5.5cm;
}

 

Here is the HTML portion of the PHP script:

 

<html>
<head>
<link rel="stylesheet" type="text/css" href="Prn_Scrn120SQL.css" media="screen">
<link rel="stylesheet" type="text/css" href="print120SQL.css" media="print">
<title> List of Verses</title>
    
</head>
<body {page: land}>
<div id="Text" class= "cc01" align="center">
<p>	
<?php

ECHO $display_block;

?>
</p>
</div>
</body>
</html>

Try:

 

.cc01               { /* Common */
font            : 24px 'French Script MT' !important;
color           : #000000;
}

 

or

 

.cc01               { /* Common */
font-family  : 'French Script MT' !important;
font-size     : 24px;
color           : #000000;
}

Hi Ivan

 

Actually someone from another forum came up with the answer to the Font problem - It was solved by changing the font size to pt (point).

 

However I still do not have any answer to how to get it to print in the right orientation.

 

Have you any ideas?

 

Rocky48

Hi Ivan

 

Actually someone from another forum came up with the answer to the Font problem - It was solved by changing the font size to pt (point).

 

However I still do not have any answer to how to get it to print in the right orientation.

 

Have you any ideas?

 

Rocky48

 

Yea that may be because 'font' accepts only PT, while font-size can accept px, em, pt...

 

 

 

You can't actually align it to center if you entered position: absolute; and stuff...

These are possible solutions to orientation:

 

<center>
<div id="Text" class= "cc01">
<p>	
<?php

ECHO $display_block;

?>
</p>
</div>
</center>

 

<div style='text-align: center;'>
<div id="Text" class= "cc01">
<p>	
<?php

ECHO $display_block;
</div>
?>
</p>
</div>


div#Text{
float: center;
}

 

  • Solution

Hi Ivan

 

That would through all the positioning I have carefully worked out.

 

Just to elabourate, I am trying to produce a utility to print out greetings inserts for handmade cards.

The position that it prints out is critical, as for an A5 portrait insert it must print Landscape in the righthand half of the page and so it looks right it is centred with the box.

 

This part is working OK!

 

I just need to orientate the page.

 

I have just found a php script to output as PDF, so I am investigating this!

 

Thanks for your help!

Rocky48

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.