简体   繁体   中英

Offset div element in Asp.net c#

Hi guys so i have a div slider element im trying to put in, but however i cannot seem to offset it at all my code is this:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="StyleSheet.css" rel="stylesheet" />


    </asp:ContentPlaceHolder>
    <style type="text/css">
        .auto-style2 {
            width: 277px;
            height: 150px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
     <div>
          <div class="Navbar">
           <div class="Log">
           <ul>
                  <li><a href="#">Login</a></li>
                  <li><a href="#">Register</a></li>  
           </ul>
       </div>
    </div>
         <div class="Header">
            &nbsp;<%-- <div id="boxtest">
                <input id="Textbox" type="text" name="test"/>
            </div> --%><img alt="gmaa" class="auto-style2" src="GMAA%20Logo%20Large%20Resized.png" />
             <div class="nav">
                 <ul>
                <li><a href="#">Parents</a>

                </li>
                <li><a href="#">Providers</a>

                </li>
                <li><a href="#">About Us</a>

                </li>
                <li><a href="#">Faqs</a>

                </li>
                <li><a href="Applicants.aspx">Applicants</a>

                </li>
            </ul>
             </div>
         </div>
       <div class="slider">
    <img src="GMG%20Logo%20Large%20slider.jpg"  border="0" alt="GMG"/>
    <img src="GMAA%20Logo%20Large%20slider.png" border="0" alt="GMAA" />
    <img src="GMRC%20Logo%20Large%20Slider.png" border="0" alt="GMRC"/>
</div>

    </form>
    </div>
</body>

</html>

now from my css it seems that everything should work as i moved an element that was inside of a div earlier but now its just not working at all?, does anyone have any tips, also here is the css for the slider element:

div.slider {
   width:1000px;
   height:541px;
   overflow:hidden;
   margin:auto;
   left:-50px;
}

Simply put,... in order to position a div within its parent, make the parent element position:relative;

<div style="position:relative; height:500px; width:100%;">
    <div style="position:absolute; left: 60px; top:60px; width:10px; height:10px;">
        absolute
    </div>
</div>

Next... why not look into JS library which supports this out of the box.?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM