HTML help please

deniser

Free Member
Jun 3, 2008
8,081
1,697
London
Can someone kindly help me with this question please. How do I make the font size one size smaller. Is it in here somewhere?

<p style="float: right">
{{ "now" | date: "%m/%d/%y" }}
</p>

<h1 style="font-family: Verdana, sans-serif">{{ shop_name }}</h1>

<h3>Invoice</h3>
 
HTML defines a range of typical header sizes H1, H2, H3..H6, usually decreasing in size, so H1 is the largest. By selecting the next H tag you can decrease the font size.

The actual font and size used for each different H tag are probably defined in a CSS file.
 
Upvote 0
Deniser,

I'd agree with Alan regarding H1, H2 etc. However, if you want to retain the notion of an H1 tag then I suggest you can use the <small> tag. Like so:

<h1><small>Your Title</small></h1>
 
Upvote 0
I suspect deniser is formatting an invoice form, and isn't going to be bothered about SEO (the main reason for suggesting retaining an H1 tag).
 
Upvote 0
If you want everything one size smaller then you need to change the style of the <body>

However, you can't fully control the font size - it's browser and user dependent.
 
Upvote 0
(Ask a simple question and get three slightly different answers.)

What we should have asked is:

Which piece of text are you trying to make smaller:
The date?
The shop name?
The word "Invoice"?
All of the above?
 
Upvote 0
Assuming you're tring to make the word Invoice smaller, You will have to either change the word invoice so it isnt a Heading tag <h3> and instead make a custom css style using <p>

If you'd like to keep the H tag you'll have to define the changes in your CSS.

If not, try this <p style="font-size: 16px;">Invoice</p>

Change the 16px to whatever size you require.
 
Upvote 0
First of all, you can designate the text size on your web page using the 'size' attribute in the HTML font element code. If no size is defined for text on a web page then the web browser will display the text at size 3.
 
Upvote 0
If not, try this <p style="font-size: 16px;">Invoice</p>
Never, ever, ever use px (or pt) for font sizes.

Always use percentage or em.

The browser will default to 1em so if you want it a bit smaller just add style="font-size: 90%;" to the applicable element
 
Upvote 0
(Ask a simple question and get three slightly different answers.)

What we should have asked is:

Which piece of text are you trying to make smaller:
The date?
The shop name?
The word "Invoice"?
All of the above?

All of it please.

It's a printable document so whilst it looks fine on screen, it's too big to read comfortably when printed onto an A4 sheet. SEO is not relevant.

Would I be better off selecting a different font altogether then?
 
Last edited:
Upvote 0
Don't use the screen stylesheet for the invoice. When you print use a print only stylesheet. This should be left at the default so that the printer looks after the formatting.

You cannot be sure what printer the client is going to use to don't try to fix the size of anything. This means removing anything that suggests 'font-size='.
 
Upvote 0
It is best to style the font using Cascading Style Sheet code. You either place all of your CSS in a document you call at the top of every HTML page, or you can add the style coding into the header of your HTML. The former is better, as if you change your mind, you can make one change and the whole site is changed.

To call a stylesheet, one normally adds something like this to the <head> section:

<link rel="stylesheet" href="css/styles.css" type="text/css">

I actually call the stylesheet via a full URI, but I have not made enough posts to post URIs yet. Using the full URI means search engines pick the style sheet up as well and your cached website has all of its styling.

Inside styles.css, you can then decide how to format your code. To answer the original posters question, my H1 looks like this:

h1 { font-family: Arial, Helvetica, sans-serif; font-size: 18px; font-style: normal; font-weight: bold; color: #000066; text-align: center; background-color: transparent; }

If I wanted a smaller font, I would simple change the font-size to 16px.

If you want to code it to the top of your HTML, add (inside the <head> section) something like this:

<style>
h1 { font-family: Arial, Helvetica, sans-serif; font-size: 18px; font-style: normal; font-weight: bold; color: #000066; text-align: center; background-color: transparent; }
</style>

You can also use the above method to override your main style sheet, for example:

<style>
H1 { font-size: 16px; }
</style>

Would override the 18px sizing from the style sheet, but only for that one page.

I hope this helps.

:)
 
  • Like
Reactions: deniser
Upvote 0
@deniser
If you want to reduce the font on all the text, I suspect you're going to have to modify the .css file that the form uses. That's because each of the elements of a page can have a different size specification, although most of it will be in headers (Hn tags) and 'body' text.
 
Last edited by a moderator:
Upvote 0

Latest Articles