【问题标题】:How we get Style with appropriate with class name我们如何通过适当的类名获得 Style
【发布时间】:2015-01-19 06:46:48
【问题描述】:

我想用他们之前为所有班级定义的样式替换它们。我在 iOS 上比较新。它是动态 HTML。以任何格式呈现。我想用合适的样式替换<p class="p1"><span class="s1">Sent

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <title></title>
    <meta name="Generator" content="Cocoa HTML Writer">
    <style type="text/css">
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 15.0px 'Helvetica Neue'}
    span.s1 {font-family: 'Helvetica Neue'; font-weight: normal; font-style: italic; font-size: 15.00px; text-decoration: underline}
    span.s2 {font-family: 'HelveticaNeue-BoldItalic'; font-weight: bold; font-style: italic; font-size: 15.00px; text-decoration: underline}
    span.s3 {font-family: 'Helvetica Neue'; font-weight: normal; font-style: normal; font-size: 15.00px}
    </style>
    </head>
    <body>
    <p class="p1"><span class="s1">Sent</span><span class="s2"> from </span><span class="s3">Zone</span><span class="s2"> Mail for </span><span class="s1">iOS</span></p>
    </body>
    </html>

【问题讨论】:

    标签: javascript html objective-c iphone


    【解决方案1】:

    您可以通过覆盖样式规则或简单地重复使用相同的规则来替换样式

    1) 覆盖样式规则

    span.s1 {/*some css rules*/}
    

    然后在稍后的代码文件中

    span.s1 {/*some different css rules*/}
    

    s1 类现在将有最新的规则

    2) 以不同的名称重用 CSS 规则

    span.s1, span.s2, s3 {/* CSS rules */}
    

    具有上述类的所有元素都将具有相同的 CSS 效果。

    希望对你有帮助!

    【讨论】:

      猜你喜欢
      • 2013-09-02
      • 2011-11-10
      • 2020-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多