2011-12-17 4 views
0

Я пытаюсь уложить #Direction Div поверх двух других Divs #Ratedpics и #Mainpics. Я хочу, чтобы они были сосредоточены друг на друге. Также, когда изменяется размер страницы, я хочу, чтобы они перемещались пропорционально странице. Это возможно?Stacking Divs в Css

Оцененные фотографии и основные фотографии должны быть рядом. Направления должны быть сосредоточены сверху.

div#MainPics 
    { 
     height: 650px; 
     width: 60%; 
     -moz-border-radius: 35px; 
     border-radius: 35px; 
     background-color: Black; 
     margin-left: auto; 
     margin-right: auto; 
    } 
    #ratedpic 
    { 
     position: relative; 
     float: left; 
     width: 22%; 
    } 
    div#Direction 
    { 
     width: 20%; 
     margin-left: auto; 
     margin-right: auto; 
    } 



<div id="Direction"> 
    <asp:Label ID="Label1" runat="server" Text="Here i want my directions centered on top of main pics" Font-Size="Large" 
     Width="270" Font-Bold="True" ForeColor="#1B0358"></asp:Label> 

</div> 
<div id="ratedpic"> 
    <p> 
     <asp:Label ID="RatedPicnameLabel" runat="server" Text=""></asp:Label> 
    </p> 
    <asp:ImageButton ID="RatedImage" Width="70%" runat="server" /><br /> 
    <asp:Label ID="RatedPicRating" runat="server" Text=""></asp:Label><br /> 
</div> 
<div id="MainPics"> 
    <div id="RightPic"> 
     <p> 
      <asp:Label ID="FirstPicMemberNameLabel" runat="server" Text="" Font-Bold="True" ForeColor="White"></asp:Label> 
     </p> 
     <asp:ImageButton ID="FirstPicLink" Width="90%" runat="server" /> 

    </div> 
    <div id="LeftPic"> 
     <p> 
      <asp:Label ID="SecondPicMemberNameLabel" runat="server" Text="" ForeColor="White" Font-Bold="True"></asp:Label> 
     </p> 
     <asp:ImageButton ID="SecondPicLink" Width="90%" runat="server" /> 

    </div> 

</div> 

Html Выход

<div id="Direction"> 
    <span id="MainContent_Label1" style="display:inline-block;color:#1B0358;font-size:Large;font-weight:bold;width:270px;">Chose the photo you like better.</span> 

</div> 
<div id="ratedpic"> 
    <p> 
     <span id="MainContent_RatedPicnameLabel">Margaret</span> 
    </p> 
    <input type="image" name="ctl00$MainContent$RatedImage" id="MainContent_RatedImage" src="Pictures/6f455ca0-27a0-49c3-ab61-e3f19e2e8258.jpg" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$MainContent$RatedImage&quot;, &quot;&quot;, false, &quot;&quot;, &quot;Member.aspx?UserID=9&quot;, false, false))" style="width:70%;" /><br /> 
    <span id="MainContent_RatedPicRating">Banged: 52%</span><br /> 
</div> 
<div id="MainPics"> 
    <div id="RightPic"> 
     <p> 
      <span id="MainContent_FirstPicMemberNameLabel" style="color:White;font-weight:bold;">Jessica-Jean</span> 
     </p> 
     <input type="image" name="ctl00$MainContent$FirstPicLink" id="MainContent_FirstPicLink" src="Pictures/2b5c7b66-00c4-4948-aa2b-7abef2f556f3.jpg" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$MainContent$FirstPicLink&quot;, &quot;&quot;, false, &quot;&quot;, &quot;default.aspx?yesId=7&amp;noId=7&quot;, false, false))" style="width:90%;" /> 

    </div> 
    <div id="LeftPic"> 
     <p> 
      <span id="MainContent_SecondPicMemberNameLabel" style="color:White;font-weight:bold;">Amy</span> 
     </p> 
     <input type="image" name="ctl00$MainContent$SecondPicLink" id="MainContent_SecondPicLink" src="Pictures/ce698138-1dfc-46f8-aab7-fd7a1d5c5f0b.jpg" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$MainContent$SecondPicLink&quot;, &quot;&quot;, false, &quot;&quot;, &quot;default.aspx?yesId=12&amp;noId=7&quot;, false, false))" style="width:90%;" /> 

    </div> 

</div> 
+1

Вы должны поделиться разметкой HTML для большинства из нас, чтобы протестировать, а не сценарий ASP. Хотя, я не вижу правило 'z-index' в любом месте ваших определений CSS. – Shef

ответ

1

Если я правильно понимаю ваш вопрос, вы будете нуждаться в дополнительной оберткой ratedpic и mainpic: http://jsfiddle.net/rgq4d/

Я также настоятельно рекомендую сделать ваши CSS идентификаторы все строчные буквы, чтобы предотвратить опечатки.

+0

Спасибо, что сработал. Я высоко ценю совет. Мне нужно больше думать о стандартах. – CsharpBeginner