无法在td中设置元素的样式

时间:2017-11-24 17:32:43

标签: html css

我一直试图设计h3和p标签的样式,但我无法做到。我尝试过class,id,divs和span,但无济于事。我对编码也很陌生,所以我很抱歉这个糟糕的缩进。



h3, p {
	color:#2c6ffe; 
}

<tr>
        <td colspan="2">
            <u><h3>Introduction:</h3></u>
            <p><i>To Kill A Mockingbird</i> is a coming of age novel that was 
            written by Harper Lee. The story To Kill A Mockingbird is not based on 
            a true story but references in Harper Lee’s daily life. The book was 
            written in at the time of the Great Depression and the Jim Crow laws, 
            taking place in the early 1930s. The story takes place in Maycomb, 
            Alabama, and is narrated by the main character, a little girl named 
            Jean Louise “Scout” Finch. Scout’s father, Atticus Finch, is a lawyer 
            with high moral standards.The book is an accurate representation of 
            racism and discrimination towards black people in early 1900s. Scout, 
            who happens to be the protagonist of the story, is also the narrator 
            as the story is seen through her eyes and explained through her 
            thoughts.</p>
         </td>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

您是否尝试用<tr></tr>包裹整个<table></table>? 当您按F12(对于DevTools)时,您是否在控制台中收到任何错误消息?

尝试将您的HTML粘贴到Codepen.io中,看看它是否在那里工作 您还可以尝试使用查询选择器更具体,例如

table > h3{ color: black;}

或者如果所有其他方法都失败了,可以使用内联样式

<h3 style="color: black;">Mockingbird</h3>

这也不是很好的做法,但在CSS中应用!important标签可能会解决一些级联问题。

h3{ color: pink !important}