Item inside td tag

<table>
    <tr>
        <td>Hello StackOverFlow</td>
    </tr>
</table>

Hello! I'm new to html, can someone tell me which type of element is the word "Hello StackOverFlow" inside the td tag ? Is this a shortcut?

+4
source share
2 answers

The element inside the tag <td>is the text node. You cannot address it in CSS. If you want to style it, you will need to tag the tag <td>or surround the text you want to style with the element <span>.

To, for example, stylize only Hello:

<table>
    <tr>
        <td><span>Hello<span> StackOverFlow</td>
    </tr>
</table>

And in your CSS

span { font-weight: bold; }

Or any style you want to give him.

. .

+3

Hello Stackoverflow? td nodeType

//Gave your td an id of 'td'
alert($('#td').contents().get(0).nodeType);

3. 3 , .

nodeType:

w3schools image on nodeType

w3schools nodeType

+3

All Articles