<分区>
<分区>
我遇到了以下问题:
这是我目前得到的结果:
它是由这段 HTML 代码生成的:
.box-2 /*targeting class from HTML*/
{
border:8px dotted #ccc;
}
<!--Who we are-->
<div id="whoweare" align="center" class="box-2">
<div align="center>
<font color="#534f4f" size="+1">
<h1 id="txt_whoweare_headline">Who we are</h1>
</font>
</div>
<div style="padding-left: 15px; padding-right: 15px">
<table border="0">
<tr> <!--tablerow-->
<th width=400px>
<div align="center">
<img
src="./img/me.png"
width=60%>
</div>
</th>
<td width=400px>
<div align="justify">
<font color="#534f4f" size="+2" >
<h3>Julius Tolksdorf</h3>
<div id="txt_whoweare_body1">CEO of innomotion media and head of software development.</div>
<div id="txt_whoweare_body2">
He will be your primary contact during the planning and development processes.
Julius has already finished about 20 apps, games & web pages and has years of experience being an Android & Unity developer.
</div>
</font>
</div>
</td>
</tr> <!--for padding-->
<tr height=20px/>
</tr>
</table>
</div>
</div>
正如您可能看到的那样,“JULIUS TOLKSDORF”的文本从左侧图像下方的一行开始。当然,我希望他们都从同一条线开始。 CSS 就是这样:
.box-2 /*targeting class from HTML*/
{
border:8px dotted #ccc;
}
如果有人指导我解决上述问题,我将不胜感激。
谢谢你:)
最佳答案
标题标签默认有边距,所以你的 <h3>
也有这个 margin 。您的问题的解决方案是设置 margin
到顶部的 0。
此代码类似于:
h3 {
margin-top: 0;
}
注意:这将删除页面中所有 h3 元素的上边距。
关于HTML:为什么文字比图片低一段? (有图),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56126912/