html - div 的右侧太长。我该如何解决?
问题描述
我在这个简单的桌子上遇到了麻烦,它被一个绿色的盒子包围着,它是 div。
绿色框的右侧一直延伸到右侧。我希望它紧贴在桌子周围。我该如何解决?谢谢!
这是我的 HTML 和 CSS 代码。
.tblEdu{
position: relative;
left: 100px;
right: 100px;
background-color: #e8efeb;
}
table{
text-align: left;
position: relative;
left: 10px;
color: #214252
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="styles.css">
<title></title>
</head>
<body>
<h3>Education</h3>
<div class="tblEdu">
<table cellspacing="20px">
<tr>
<th>School</th>
<th>Years</th>
<th>Diploma</th>
</tr>
<tr>
<td>The Lorem State University</td>
<td>2012-2016</td>
<td>Bachelor of Science Degree in Information Technology</td>
</tr>
<tr>
<td>Ipsum High School</td>
<td>2008-2012</td>
<td>High School Diploma</td>
</tr>
</table>
</div>
</body>
</html>
解决方案
推荐阅读
- java - LDAP - InitialDirContext 创建 - 超时不起作用
- r - 如何解决R中的“所有重新编码都应该是公式”错误
- google-kubernetes-engine - 通过 gcloud 302.0.0 创建和更新 GKE 集群失败
- php - 在请求 php API 的 bash 脚本中调用 cURL 时返回 HTML 错误 404 而不是 JSON
- javascript - 在数独检查器中添加一行会破坏我的代码
- python - 在熊猫条形图上自定义日期
- sql - 如何在SQL中的单元格内生成两个数字之间的数字范围
- css - 弹性盒内的宽高比响应 Youtube 视频
- wpf - 如何灰度化整个 WPF 应用程序
- xml - XML - 将 xi:include 替换为引用文件中的实际内容