简体   繁体   English

使用CSS3选择器无法在TR中获得第一个td

[英]Can't get first td in tr with css3 selectors

I am having an issue selecting the first td in the tr on a table that is being created. 我在选择要创建的表中tr的第一个td时遇到问题。

I am using 我在用

.record_list tbody tr td:first-child { text-align: center; }

and that does not work. 那是行不通的。 No styles are being applied. 没有样式被应用。

here is the html, im trying to get the td with the check mark. 这是html,即时通讯试图获取带有复选标记的td

<table class="records_list">
        <thead>
            <tr>
                <th>✔</th>
                <th>Title</th>
                <th>Notes</th>
                <th>Project</th>
                <th>Context</th>
                <th>Flagged</th>
                <th>Deferuntil</th>
                <th>Due</th>
                <th>Repeattask</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>✔</td>
                <td>This is another task title</td>
                <td>this is another note that will go with this task, just so nothing is forgotten.</td>
                <td>secondproject</td>
                <td>secontcontext</td>
                <td>1</td>
                <td></td>
                <td>2014-02-12 08:17:00</td>
                <td></td>
                <td>
                <ul>
                    <li>
                        <a href="/workspace/symfony/web/task/10">View</a>
                    </li>
                    <li>
                        <a href="/workspace/symfony/web/task/10/edit">Edit</a>
                    </li>
                </ul>
                </td>
            </tr>
                    <tr>
                                <td></td>
                <td>Lorem ipsum dolor sit amet</td>
                                <td>this is a note that will describe anything that needs to be remembered about the note.</td>
                <td>thisisaproject</td>
                <td>thisisacontext</td>
                <td>1</td>
                <td></td>
                <td></td>
                <td></td>
                <td>
                <ul>
                    <li>
                        <a href="/workspace/symfony/web/task/9">View</a>
                    </li>
                    <li>
                        <a href="/workspace/symfony/web/task/9/edit">Edit</a>
                    </li>
                </ul>
                </td>
            </tr>
                </tbody>
    </table>

you have .record_list up there in your example but .records_list in your HTML. 你有.record_list那里在你的榜样,但.records_list在你的HTML。 Is this what you're looking for? 这是您要找的东西吗?

JSFIDDLE JSFIDDLE

You have a typo records_list: 您有一个错字记录列表:

Change: 更改:

.record_list tbody tr td:first-child { text-align: center; }

With: 带有:

.records_list tbody tr td:first-child { text-align: center; }

You forgot the "s" to .record_list :) 您忘记了.record_list的“ s” :)

.records_list tbody tr td:first-child{ background: red; }

FIDDLE 小提琴

这是一个错误类型.record_list而不是.records_list

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

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