Marty
Marty

Reputation: 6184

How to change font size in HTML string?

I used an online HTML maker to get this

<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: x-large; color: #993300;\">A <strong>canyon</strong>&nbsp;is a deep, narrow valley with steep sides. &nbsp;Many canyons have rivers or streams running through them.</span></p>

But the font size is too small, and when I put a bigger size in the html maker and copy it to my code, it still shows up the same size. I'm using it in a web view to show some text with customized formatting.

Upvotes: 0

Views: 6879

Answers (3)

rrazd
rrazd

Reputation: 1739

There are two ways to approach this.

The first way is deprecated so you should not use this method:

<font size="5" face="arial" color="red">

HTML is responsible for layout and thus including design and formatting is not good.

The second way is manipulation via css:

h1 {font-size:250%}

Instead of percentages, you can use px for pixels.

Good luck!

Upvotes: 0

tanjir
tanjir

Reputation: 1334

why do you have you "\" before quote? Shouldn't it be :

<span style="font-family: arial, helvetica, sans-serif; font-size: x-large; color: #993300;">

Upvotes: 1

James Allardice
James Allardice

Reputation: 166001

You can put an actual value in the font-size property, for example font-size:48px. If you put in a large enough number, it should show up larger than using x-large.

Upvotes: 1

Related Questions