CSS:div不会向左浮动(浮点数:左)

时间:2017-01-16 04:13:54

标签: css

我无法让#sitedescription向左浮动,因此它显示在this site上的#title-link下方。

.header #logo {position: relative; width: 90px; float: left;}
.header #title-link {position: relative; height: 20px; width: 200px; margin-bottom: 11px; float: left;}
.header #sitedescription {position: relative; height: 14px; width: 200px; float: left;}
.header #sitedescription h2 {position: relative; font-size: 11px; color: #622C82;}

<div class="logo">
    <div id="logo"><a href="/"><img id="header-logo" src="/wp-content/themes/madhatmedia/images/header-logo.png" data-pin-nopin="true"></a></div>
    <div id="title-link"><a href="/"><h1 class="title">Mad Hat Media</h1></a></div>
    <div id="sitedescription"><h2>Marketing Agency Fremantle</h2></div>
</div>

标题需要如下所示: enter image description here

帮助表示赞赏。

2 个答案:

答案 0 :(得分:0)

嗨,你可以说清楚:两个代码如下(在该类中添加额外的代码)并根据需要增加字体大小

.header #sitedescription {
position: relative;
height: 14px;
width: 300px;
display: block;
clear: right;
left: -27px;
}

Demo

感谢

答案 1 :(得分:0)

updated screenshot从.header #sitedescription中删除浮动,将其添加到标题下。

.header #sitedescription {position: relative; height: 14px; width: 300px;}