在同一行上对齐两个元素 [英] Align two elements on the same line

查看:90
本文介绍了在同一行上对齐两个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在同一行上对齐两个不同的<p>元素.我可以使用它,但是它完全弄乱了我的徽标. 两个<p>元素是您在徽标两侧看到的测试".

I am trying to align two different <p> elements on the same line. I got it to work but it completely messed up my logo. The two <p> elements are the "TEST"s you see on either side of the logo.

用于对齐的代码是这样的: HTML代码

The code for the alignment is this : HTML CODE

<div id="logo" class="container">
<div align="center">        
    <img src="images/Logo.png" align="middle" alt="logo" height="105" width"105">
</div>
<div align="center">
 <p style="color:white;" id="countr">test</p> 
 <p style="color:white;" id="countl">test</p> 
</div>
    <h1 style="left:50px;"><span class="icon icon-size"></span><a href="#">Clubbed<span> In</span></a></h1>
<div align="center">
    <h2 class="motto" style="color : white">Connect. Communicate. Lead.</h2>
</div>

CSS

#countr{display:inline-block;float:right;} 
#countl{display:inline-block;left:35px;float:left;}

推荐答案

FIDDLE

<div>
  <p style="color:black;float:left;" id="countr">test</p> 
 <p style="color:black;float:right;" id="countl">test</p> 
</div>
    <h1 align="center" style="margin:0 auto;clear:both;"><span class="icon icon-size"></span><a href="#">Clubbed<span> In</span></a></h1>
<div align="center">
    <h2 class="motto" style="color : black">Connect. Communicate. Lead.</h2>
</div>

这篇关于在同一行上对齐两个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆