简体   繁体   中英

html not working for firefox but works for chrome

I have a template :

<font size="2" align="justify"><br/><br/>Some long message</font>

I get justify text in chrome but not in firefox. What might be the solution?

Font tag is deprecated in HTML5 but also is always better to separate structure (HTML) and presentation (CSS) .

Use a <p> tag (paragraph) for adding long text.

<div>
<p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum  
</p>
</div>

Also the CSS property to justify text is text-align:justify;

div{
    width:500px;
}

p{
    font-size:14px;
    text-align:justify;
}

If you really have to use inline styles, you can:

<p style="text-align:justify; font-size:14px;">

DEMO http://jsfiddle.net/a_incarnati/undmcszz/5/

The html font tag is deprecated. From w3schools website:

Definition and Usage The <font> tag is not supported in HTML5. Use CSS instead. The <font> tag specifies the font face, font size, and color of text.

Source: http://www.w3schools.com/tags/tag_font.asp

Use a supported HTML structure and style it with CSS:

<p>YOUR TEXT</p>
<style>
    p {
       font-size: 12px;
       text-alignment: justify;
    }
</style>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM