2011-12-13 20 views
0

我有以下的代碼,但我的問題是關於橫幅圖像位置外樹形象主要內容

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<title>Title Goes Here</title> 
<style type="text/css"> 
<!-- 
body { 
    font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif; 
    margin: 0; 
    padding: 0; 
    color: #000; 
    background-attachment: scroll; 
    background-image: url(11.12.12_RBM2012_bkg01.jpg); 
    background-repeat: no-repeat; 
    background-position: center top; 
} 

/* ~~ Element/tag selectors ~~ */ 
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */ 
    padding: 0; 
    margin: 0; 
} 
h1, h2, h3, h4, h5, h6, p { 
    margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */ 
    padding-right: 15px; 
    padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */ 
} 
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */ 
    border: none; 
} 

/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */ 
a:link { 
    color: #42413C; 
    text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */ 
} 
a:visited { 
    color: #6E6C64; 
    text-decoration: underline; 
} 
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */ 
    text-decoration: none; 
} 

/* ~~ This fixed width container surrounds all other divs ~~ */ 
.container { 
    width: 920px; 
    margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */ 
    background-color: #000; 
} 
.header { 
} 


.content { 

    padding: 10px 0; 
    width: 920px; 
    float: left; 
} 

/* ~~ This grouped selector gives the lists in the .content area space ~~ */ 
.content ul, .content ol { 
    padding: 0 15px 15px 40px; 

/* ~~ The footer styles ~~ */ 
.footer { 
    padding: 10px 0; 
    position: relative;/* this gives IE6 hasLayout to properly clear */ 
    clear: both; /* this clear property forces the .container to understand where the columns end and contain them */ 
} 

/* ~~ Miscellaneous float/clear classes ~~ */ 
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ 
    float: right; 
    margin-left: 8px; 
} 
.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */ 
    float: left; 
    margin-right: 8px; 
} 
.clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the .container) if the .footer is removed or taken out of the .container */ 
    clear:both; 
    height:0; 
    font-size: 1px; 
    line-height: 0px; 
} 

.banner { 
} 
--> 
</style></head> 

<body> 

<div class="container"> 

<img src="banner.jpg" width="120" height="600" alt="Banner" class="banner"> 

    <div class="header"><a href="#"><img src="11.12.12_RBM2012_header01.jpg" alt="Insert Logo Here" name="Insert_logo" width="920" height="240" id="Insert_logo" style="background: #C6D580; display:block;" /></a> 
    <!-- end .header --></div> 

    <div class="content"> 
    <p>Content</p> 
    <!-- end .content --></div> 

    <p>Content</p> 
<!-- end .footer --></div> 
    <!-- end .container --></div> 
</body> 
</html> 

我希望把這個主容器外,向右側,頭下面。希望在下面,是我需要的一個例子。任何幫助?

enter image description here

+0

你可能需要將它定位。看起來像你希望它一直呆在那裏,無論滾動嗎? – Kyle

+0

嘗試將其懸浮在內容旁邊,然後設置「top:123px」將其強制向下。 – potato

回答

2

給容器元素的相對位置:

.container { 
    width: 920px; 
    margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */ 
    background-color: #000; 
    position: relative; 
} 

現在你可以給旗幟相對容器中的絕對位置:

.banner { 
position: absolute; 
left: 100%; 
top: 50px; 
} 

你可以改變當然頂級位置。如果橫幅和容器之間需要一些空間,請在橫幅上嘗試一些CSS邊距。