我正在尝试创建一个具有两种色调背景的 HTML 表格单元格;所以我在背景上有普通文本,左边是黄色,右边是绿色。
到目前为止,我最接近的是如下。背景是正确的一半,但内容文本在其下方移位。
<html>
<head>
<style type='text/css'>
td.green
{
background-color: green;
padding: 0px;
margin: 0px;
height:100%;
text-align:center
}
div.yellow
{
position:relative;
width: 50%;
height: 100%;
background-color:yellow
}
</style>
</head>
<body style="width: 100%">
<table style="width: 25%">
<tr style="padding: 0px; margin: 0px">
<td class="green">
<div class="yellow"></div>
<div class="content">Hello</div>
</td>
</tr>
</table>
</body>
</html>
我该如何解决这个问题?