can we increase the font size in html? - html

How can we increase the font size in html?
<font face="Garamond" size="7">
up to this size only it is working.
Is there any way to increase the size of the font?

You can use the font-size css property: Example
<span style="font-size:20px;">This is large Text...</span>
There is also <font> tag but it is deprecated.

The largest size the font tag supports is 7. If you need it to be larger, you will have to use CSS, which you should probably be using anyway because the font element is deprecated.
The CSS font-size values, xx-small, x-small, small, medium, large, x-large, and xx-large are comparable to <font size="1"> through <font size="7"> if you want to specify the size like that, but you would run into the same size limitation. The more typical way is to use px or pt for absolute sizes, and % or em for relative sizes.

Adding onto the answers that exist. Inline styling is usually frowned upon, because:
In huge HTML pages, this can cause a maintenance nightmare for anyone that has to maintain it.
Does not separate content from design.
They add unnecessary length to the HTML page.

Related

font-size varying on container width in iOS

We have a number of divs on a page containing text. The text is explicitly set to a certain font-size via CSS. In some circumstances the font-size is increasing without our intervention. It seems to be related to the length of the text in the DIVs. i.e. once it gets to a particular size adding a character increases the font-size, removing it again reduces the font-size.
We haven't got any fancy libraries included to scale the font.
In chrome dev tools it shows the variation in the font set via CSS, and then the computed size here:
Why does the font go from 16px to 19.555555px? What are we missing?
thanks!

How can we control the size of a special character?

I want to use the following character in a page:
<div>▼</div>
(it's a down arrow character). Is there a way to change its size? I'm not even sure how its initial size is determined anyway - can we apply a font size to it? Or is there some css scale attribute we can apply to it?
Or can I specify its exact width/height in pixels?
Thank you
You can use CSS to control it just like any other text.
https://developer.mozilla.org/en-US/docs/CSS/font-size
The size of the character is determined by the font family and the font size. Both of them can be set as usual in CSS, with the font-family and font-size properties (or even using old-fashioned HTML font tag). Setting font-size different from other text on the same line tends to cause uneven line spacing, but this does not matter if you are using the character in a block of its own, as the div markup suggests.
The character denoted by ▼ is not an arrow but U+25BC BLACK DOWN-POINTING TRIANGLE “▼”. Its relative size (relative to font size) varies a lot by font family, so you should primarily consider the font family choice, using a reasonable list of font families (with comparable size for this character), and only if needed consider font size too.
Just like any other font is controlled
<div style="font-size:x-large">▼</div>
The same way you control the size of any other character. Just set the font size.

HTML: How common is it that different browsers render 1em at a different actual px size?

As you know, you can specify dimensions with CSS in px or em. As far as I understand it, em means "line height of the current element's fonts". My approach currently is to always use px (also for margin which seems to be a controversial practice).
Question: Can I rely on the ratio of px and em to be the same across browsers? If not, then my manually specified margins between paragraphs will likely look odd because they so not match 1em anymore.
I believe that it is better to use em for margins but I have quite a base of existing code that always uses px margins.
No. ems are relative to the user's chosen font size, px aren't. The default font sizes of desktop browsers are about the same in pixels, but mobile devices in particular will vary even before user adjustment.
You should use em for a margin in text content that should be sized similarly to the surrounding fonts, and px for a margin that has to line up with images used by the page layout.
No, you cannot.
The size of em in pixels is related to the font type & size you're using, the resolution of your screen (depending on OS, browser), and possible further OS and browser settings - eg "Show fonts +10%" may alter the em value.

Liquid Layout: How to

If I mark all my divs in percent, they fill up all the space nicely. I am facing 2 problems:
a) Image sizes: How do I define image sizes so that they do not become larger or smaller than wanted as the window resizes
b) Font sizes: How do I make the font size increase or decrease based on resolution - should this be done at all? (The problem I face is that the text becomes illegible at very high resolutions)
Please point me to a good reference on how to make liquid layouts.
Regarding point b) it is, IMHO, good practice to use relative font sizes, rather than absolute ones, so that the fonts are sized compared to the browsers base settings (I'm guessing, from your problem, that you are using point or px sizes, yes?). You have the heading tags, of course, but you also have the font-size CSS attribute and the ability to size fonts in % or ems. You have hit one good reason to use relative sizes - on high res monitors this can make absolute-sized fonts unreadable (I have seen, in the old days when 14" 800x600 monitors were standard, a website that rendered to about the size of a matchbox on a high-res 21" monitor). There also the issue of "politeness" and accessibility - the user may have set their browser base-font size larger or smaller because of personal preference and/or accessibility issues, and to override this to an arbitrary size doesn't seem, to me, to be a good idea.
have a read on the font-size section of this page:
http://www.w3schools.com/css/css_font.asp
If you need some actual examples then please post a bit of your code and CSS.
Good article here
http://www.kyleschaeffer.com/best-practices/css-font-size-em-vs-px-vs-pt-vs/
for a) I love using this
img {
width:100%;
max-width:400px;
}
then, if you need to, add one of the many javascript fixes for max width in older browsers.
I found a simple solution for your second question about font size.
b) Font sizes:
Using stylesheet calculator and properties like:
vh - viewport height
vw - viewport width.
Your font size will take same size on your view, but it can be unreadable if you don't handle small sizes layout.
For regular size: font-size: calc(.5vh + .8vw);
For large size: font-size: calc(5vh + 5vw);
Hope this might help you.

What does font size -2 mean here?

I see this from source code of a web site:
<font size="-2">#2009 </font>
What does it mean when size is negative?
That is a deprecated style of markup. Nobody should be using it anymore.
Back in the old days, before CSS, you could use the <font> tag to control the relative size of text on the page. A "-2" simply meant two sizes smaller than your base font size.
Font sizes ranged from 1 to 7 in first generation browsers, if I recall correctly.
It means the font size of #2009 should be -2 units (i.e. 2 units smaller) relative to the content around it.
It means two notches smaller than the default text size in the browser.