2011-05-01 42 views
1

我設置了一些css規則和html標籤,這在設計視圖中看起來很理想。但是,當母版頁的子表單加載頁面時,它看起來不同。 css規則可以支配父css規則的屬性嗎?masterpages和css

style type="text/css"> 
#container{position:relative;} 
img#border{position:absolute; 

} 
#placeH{position:absolute; left:344px; 
    top: 325px; 
    height: 168px; 
    width: 708px; 
    bottom:287px; 
} 

<title></title> 
<asp:ContentPlaceHolder id="head" runat="server"> 
</asp:ContentPlaceHolder> 
</head> 

<div align="center" id="container"> 
    <asp:Image ID="Header" runat="server" ImageUrl="~/header.png" Width="1196px" 
     Height="280px" /> 


    </div> 
     <div id="border"> 

      <asp:Image ID="Image1" runat="server" ImageUrl="~/border.png"/>// the border 

,我嘗試在這裏設置出現在view..but對孩子的 設計視圖,,它出現在底部的母版設計精美頁面左側

   </div> 

        <div id="placeH"> 
         <form id="form1" runat="server"> 
         <asp:ContentPlaceHolder id="ContentPlaceHolder2" runat="server"> 

          </asp:ContentPlaceHolder> 
        </form> 

        </div> 
      </body> 

回答

1

,我可以從這裏看到的唯一的事情就是。你有一些CSS可能不像你期望的那樣。

img#border{position:absolute;} 

這將適用於id =「border」的<img/>標籤。在上面的HTML,你有一個div內的IMG一個id =「BORDER。你的CSS這應該是這個樣子。

div#border > img { postition:absolute; } if you want it applied to the image only. 

#border { position:absolute; } if you want it applied to the whole div. 

這其實是挺難看的在片段中的上述HTML。如果上述方法不解決這個問題,粘貼整個事情對我來說。

+0

我不知道是什麼問題。我下了屏幕邊框的圖像,並設置了整個事情出現在屏幕沒有裝飾,只有一個標題。謝謝你的幫助 – 2011-05-01 15:24:17

1

我想你應該改變的placeH風格到這一點。

#placeH{ 
    position:absolute; 
    left:344px; 
    top: 325px; 
    height: 168px; 
    width: 708px; 
} 

^^

是的,從母版頁的CSS應用的子頁面。