如何在HTML中将3个对象彼此相邻放置

use*_*533 0 html css text image

我想将图像和2个文本放在一起.第一个文本位于最左侧.图像直接位于中心.最后一个文字位于最右边.这是我现在拥有的......

<body>

<h2><font color="#99CC00"><font face="Verdana">MrEpicGaming4U</font></h2>
<img src="website_art.png" height= "75" width= "235"/>
<h2><font color="#99CC00"><font face="Verdana">The Art of Gaming</font></h2>

</body>
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

谢谢

leo*_*izo 6

您不要在HTML代码中的正确位置关闭字体元素.

此外,将样式放在外部文件中是一个很好的做法(我谈论CSS).

改变:

<body>
    <div class="container">
        <h2>MrEpicGaming4U</h2>
        <img src="Your url" height="75" width="235"/>
        <h2>The art of gaming</h2>
    </div>
</body>
Run Code Online (Sandbox Code Playgroud)

把这些CSS规则:

h2 {
    font-family: "Verdana";
    color: #9C0;
}

.container > * {
    display: inline-block;
}
Run Code Online (Sandbox Code Playgroud)