我想只使用内部div和span来设置下面div中的第一行

时间:2015-09-28 06:37:58

标签: javascript jquery css html5 css3

我想在下面的div中设置唯一的Q)文本......如果使用demo:第一行属性只有第一行是获取样式但我希望所有Q)文本... 如何实现这个....(只有一个div)

<div id="demo">
     Q)On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document.<br />
     A)You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building 
       blocks.When you create pictures, charts, or diagrams, they also coordinate with your current document look.<br /><br />


     Q)Most controls offer a choice of using the look from the current theme or using a format that you specify directly.<br />
     A)To change the overall look of your document, choose new Theme elements on the Page Layout tab. To change the 
       looks available in the Quick Style gallery, use the Change Current Quick Style Set command.<br /><br />

     Q)You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks.<br />
     A)When you create pictures, charts, or diagrams, they also coordinate with your current document look. You can easily 
       change the formatting of selected text in the document text by choosing a look for the selected text from the Quick
       Styles gallery on the Home tab <br />
</div>

1 个答案:

答案 0 :(得分:0)

如果使用<p>元素,则可以使用选择器(nth-of-type(odd))设置它们的样式。

<div id="demo">
     <p>Q)On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document.</p><br />
     <p>A)You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks.When you create pictures, charts, or diagrams, they also coordinate with your current document look.</p><br /><br />


    <p> Q)Most controls offer a choice of using the look from the current theme or using a format that you specify directly.</p><br />
    <p>A)To change the overall look of your document, choose new Theme elements on the Page Layout tab. To change the looks available in the Quick Style gallery, use the Change Current Quick Style Set command.</p><br/><br/>

    <p> Q)You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks.</p><br/>
    <p> A)When you create pictures, charts, or diagrams, they also coordinate with your current document look. You can easily change the formatting of selected text in the document text by choosing a look for the selected text from the Quick Styles gallery on the Home tab </p><br />
</div>


#demo p:nth-of-type(odd){
    color:red;
}

此致 VISHAL V M