我從來沒有使用過百分比佈局。當然,我已經研究過它們,但沒有任何練習。所以,我要求大家看到我的佈局的截圖並告訴我:我怎樣才能以不同的百分比條件顯示相同的佈局,並且最終不會丟失任何佈局質量?我的意思是,沒有div的疊加和空格。動態寬度使用百分比
正如你看到的,我的佈局「R確定。但是,在1024x768,我們有一個小間距。另一方面,在1920x1080,我們已經超過了層之間的空間。我正在使用CSS來做到這一點。看:
section#FeedDeck {
width: 100%;
height: 100%;
float: left;
}
.FeedContainer {
width: 100%;
float: left;
padding-bottom: 25px;
border-bottom: 1px solid #b9b9b9;
}
.LeftFeedSide {
width: 10%;
float: left;
}
.CenterFeedSide {
width: 80%;
float: left;
}
.RightFeedSide {
width: 10%;
float: right;
text-align: right;
font-size: 12px;
}
.RightFeedSide a {
width: 100%;
float: left;
}
我的HTML:
<section id="FeedDeck">
<div class="FeedContainer">
<div class="LeftFeedSide">
<img src="60x60.jpg" alt="" />
</div>
<div class="CenterFeedSide">
<header id="FeedContent">
<h1>Anne Hathaway</h1>
<h4>Diretora de Design</h4>
</header>
<p>
Can you fix a broken drug company research lab?
</p>
<p>
Jack Scannell, the European pharmaceuticals analyst at
Sanford C. Bernstein, recently held a conference on the future
of drug research and development. On the last day, he had representatives
from two of the most successful drug development organizations on the planet:
Sean Bohen, who heads early resaerch and development at Genentech, part of Roche,
which has had a legendary string of cancer drug successes; and Mads Krogsgaard Thomsen,
the chief scientific officer at Novo Nordisk, one of the dominant players in diabetes and
the best-performing big pharma stock over the past decade. This story is based on a transcript
of their talks.
</p>
</div>
<div class="RightFeedSide">
<a href="#">#1</a>
<span>há um minuto atrás</span>
</div>
</div>
</section>
請創建一個jsfiddle;這將使它更容易幫助。 –
你想要什麼_less spacing_或_more spacing_?我的意思是哪一個是正確的? – Asif
@AaronDigulla:如你所願。等一下。 + Asif:我需要我的圖層之間有相同的間距。我可以用像素來做到這一點,但我無法使用它們。我想要的正確方式是1024x768像素分辨率。 –