2016-04-15 80 views

回答

0

你可以通過像在你的CSS文件中指定位置固定的風格和形象廣告部分:

img {position:fixed;} 
+0

我想知道如果有可能不合並IMG {能力這樣做的:固定;}代碼與圖像,廣告代碼。 – harsher

+0

我想保留一個SPACE固定...沒有代碼的東西。 – harsher

+0

你能否提供你的問題與你寫的代碼!或詳細解釋你究竟想要什麼? 或者如果你可以使用bootstrap,那麼你可以在你的perticular div中添加class =「affix」! –

0

你應該看看用CSS布點。更具體地說,position屬性。 你的情況,你可以如下定義CSS類,並將其分配給你的元素:

.makeMeFix { 
    position:fixed, 
    bottom: 0px, 
    left: 0px, 
    width: 30px, 
    height: 30px 
} 

這將導致一個元素的大小爲30x30px被固定在左下角。 http://www.w3schools.com/css/css_positioning.asp

0

添加位置固定,並用css頂部,左側修改其位置,右邊或底部

.img-container { 
 
    position: fixed; 
 
    top: 0; 
 
    width: 100%; 
 
    height: 50px; 
 
    background-color: black; 
 
}
<div class="img-container"> 
 
    <!-- Put image here --> 
 
</div> 
 

 
<div class="text-content-container"> 
 
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> 
 
    <p>t is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p> 
 
    <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p> 
 
    <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p> 
 
</div>

相關問題