Home  >  Article  >  Web Front-end  >  There is a tr table in the div tag. How to set the CSS style? _html/css_WEB-ITnose

There is a tr table in the div tag. How to set the CSS style? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:11:441397browse

<div id="subpage">     <tr id="serverlist">       <table>        <tr class='serverinfo'>        <td class='servericon'>		        </td>        <td>               </td>        <td></td>        <tr>        <td></td>             <td>          </td>        <td>        </td>        </tr>        </table>        </tr>        </table>     </div>

How to set the styles of serverlist, serverinfo and servericon? I used #subpage #serverlist{ } but it didn't work.


Reply to the discussion (solution)

The poster table tag must be complete, organize the tags and then set the css

The poster table tag must be complete , organize the tags and then set the css
Does the table need to have an ID? Assuming that the ID of the table is servertable, how to set the styles of serverinfo and servericon? And table should have no effect on serverlist

My tags are nested

95d54e9583a1efd0ddcf23fbe223b888
🎜>
Why is there tr directly under your div?



<!DOCTYPE HTML><html>	<head>		<meta charset="gb2312" />		<title></title>		<style>			#subpage #serverlist{ color:red; }		</style>	</head>	<body>		<div id="subpage">			<table>				<tr id="serverlist">					<td>						<table>							<tr class='serverinfo'>								<td class='servericon'>								</td>								<td>								</td>								<td>123</td>							<tr>								<td>123</td>								<td>								</td>								<td>								</td>							</tr>						</table>					</td>				</tr>			</table>		</div>	</body></html>


There is also appropriate indentation of the code to facilitate reading and writing.

My tags are nested


95d54e9583a1efd0ddcf23fbe223b888
Why is it directly tr below?


HTML code

fef50554eca1a427827adaa329da8122
100db36a723c770d327fc0aef2ce13b1
93f0f5c25f18dab9d176bd4f6de5d30e
;
              b2386ffb911b14667cb8f0f91ea547a7 For example, if I set the distance between it and the left border to be 30px, no matter whether I set margin-left or padding-left, it will not work.

If you don’t complete the html tag, it will destroy the structure of the web page. . .

It is the td that actually holds the content, so you need to set the style of the td.

It is the td that actually holds the content, so you need to set the style of the td.

If this is the case:

I want to set the margin-left of the td element with class servericon to 30px. How to achieve this?

The original poster: margin is the outer margin and padding is the inner padding

Setting the margin-left of the servericon here can be achieved by setting its own padding or setting the padding of the parent DOM td or table or div

 <div id="subpage">            <table>                <tr id="serverlist">                    <td>                        <table>                            <tr class='serverinfo'>                                <td class='servericon'>                                  123                                </td>                                <td>                                </td>                                <td></td>                            <tr>                                <td>123</td>                                <td>                                </td>                                <td>                                </td>                            </tr>                        </table>                    </td>                </tr>            </table>        </div>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn