简体   繁体   English

html不适用于Firefox,但适用于Chrome

[英]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. 我在chrome中找到了正当性文本,但在Firefox中却没有。 What might be the solution? 有什么解决方案?

Font tag is deprecated in HTML5 but also is always better to separate structure (HTML) and presentation (CSS) . 字体标签在HTML5中已弃用,但始终最好将结构(HTML)表示(CSS)分开。

Use a <p> tag (paragraph) for adding long text. 使用<p>标记(段落)添加长文本。

<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; 同样, text-align:justify;的CSS属性是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/ 演示 http://jsfiddle.net/a_incarnati/undmcszz/5/

The html font tag is deprecated. html字体标签已弃用。 From w3schools website: 从w3schools网站:

Definition and Usage The <font> tag is not supported in HTML5. 定义和用法HTML5不支持<font>标记。 Use CSS instead. 改用CSS。 The <font> tag specifies the font face, font size, and color of text. <font>标记指定字体,字体大小和文本颜色。

Source: http://www.w3schools.com/tags/tag_font.asp 资料来源: http : //www.w3schools.com/tags/tag_font.asp

Use a supported HTML structure and style it with CSS: 使用支持的HTML结构并使用CSS设置样式:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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