[英]Formatting in HTML vs CSS in epub
I've been looking around a little and haven't found an answer to this question. 我一直在四处张望,却找不到这个问题的答案。 I am making an epub book and I've no idea what is the most adequate practice, if style italic, bold or underlined text in the html file, using
<i>
, <b>
and <u>
tags or define this in a class in the styles sheet. 我正在制作一本epub书,我不知道什么是最适当的做法,如果使用
<i>
, <b>
和<u>
标签在html文件中使用斜体,粗体或带下划线的文本样式,或在样式表中的类。 Can somebody clarify this to me, please? 有人可以向我澄清一下吗?
It depends on the situation. 这取决于实际情况。 For example, in a paragraph, if the developer only wishes to make some text italic , then there is no reason to create a class for it.
例如,在一段中,如果开发人员只希望将某些文本设置为斜体 ,则没有理由为其创建类。 However, if there is a specific case where text must have a format while inside of a specific tag structure, this is when you should create a class.
但是,如果在特定情况下文本在特定标记结构中必须具有某种格式,则应在此情况下创建一个类。
Use a CSS Class
使用CSS类
<div id="important">
<p>This should always be italic under this condition</p>
<p>And so should this</p>
</div>
<div>
<p>But this should not</p>
</div>
<div>
<p>And maybe I want to have multiple styles at once. <span class="underline-bold-italic">Use a class</span></p>
</div>
Use A Tag
使用标签
<p>Hmmm... <i>this</i> may be important.</p>
I think whichever is used, it should be consistent. 我认为无论使用哪种方法,都应该保持一致。 Remember you can override the effect an
<i>
tag will have by adding appropriate CSS. 请记住,您可以通过添加适当的CSS来覆盖
<i>
标记的效果。 If you decide later on that everything italic should also be red, you only want to change that in one place. 如果您以后决定所有斜体也都应为红色,则只希望将其更改为一个位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.