2012-01-25 124 views
2

我有點生鏽與CSS,我卡住了這一點,我想實現的是有兩個div並排與圖像重疊的兩個頂角,這我有多少事(希望正確),有什麼我堅持做的是試圖中心的兩個並排側的div我現在不能做沒有打破它居中兩個並排div

任何幫助將是巨大的,謝謝

<style> 
#wrapper { 
    margin:0 auto; 
    height:auto; 
    overflow: hidden; /* add this to contain floated children */ 
} 
#first { 
    width: 300px; 
    float:left; /* add this */ 
    color:#FFF; 
    padding:0 5px 5px 5px; 
    background: url(view.image?id=598) 0 100% #fcb033 no-repeat; 
} 
#second { 
    width: 300px; 
    float: left; 
    padding:0 5px 5px 5px; 
    color:#FFF; 
    background: url(view.image?id=595) 100% 100% #c1d72e no-repeat; 

} 
    #overlayleft{ 
     position:absolute; 
     top:-40px; 
     left:-30px; 
    } 

    #overlayright{ 
     position:absolute; 
     top:-40px; 
     left:570px; 
    } 
    </style> 


    <div id"wrapper"> 
    <div id="first"><div id="overlayleft"><img alt="Dr Sayer" height="94" src="view.image?Id=592" width="93" /></div><h1 style="text-align:right">Dr John Sayer</h1><p>Cystic kidney diseases, such as polycystic kidney 
    disease (PKD), are responsible for ten per cent of 
    patients requiring dialysis and transplantation in 
    the UK. As with most cystic kidney diseases, PKD 
    is a genetic condition which causes fluid-filled 
    sacks to develop on the interior and exterior of 
    the kidneys. These sacks gradually replace normal 
    kidney tissue, enlarging the organs and reducing 
    their ability to function – eventually causing them 
    to fail altogether. A recently discovered gene, 
    involved in the onset of cystic kidney diseases, 
    has provided a basis for the work of Dr John Sayer. 
    Dr Sayer is studying this specific gene closely and 
    hopes not only to improve our understanding of 
    the molecules which cause cystic kidney diseases, 
    but also test potential new drug treatments aimed 
    at preventing the formation of cysts.</p></div> 

    <div id="second"><div id="overlayright"><img alt="Donate" height="94" src="view.image?Id=592" width="93" /></div><h1>Carol Norbury</h1> 
    <p>Carol Norbury’s family has a prolonged history of polycystic 
    kidney disease. Her husband, John, was diagnosed with the condition in 1996, before 
    going on to suffer complete renal 
    failure in late 2004. Luckily, Carol 
    was found to be a suitable organ 
    donor. However, since then, each 
    of Carol and John’s three children 
    has been diagnosed with 
    the condition.</p></div> 
    <div class"clear"></div> 
    </div> 

回答

0

您必須在「margin:0 auto;」的包裝器上指定寬度上班。

,你就錯過了等號包裝標識