none
Poisitioning of an element using CSS in ASP.Net RRS feed

  • Question

  • Good day

    I am learning about CSS and want to apply it in ASP.NET. I am struggling however  the positioning of the elments on the asp.net page.

    For example applying the following does not make much of a difference to the positioning of the element .menu for example.

    .menu { z-index:3; position : absolute; width:180px; top:355; left: 0; }

    What is the best why to manipulate the position of the various elements on an ASP.NET form? kind regards

    This is the markup for .menu
    <div class="menu">
    			
    			<ul>
    				<li>Add Books</li>
    				<li>Review Books</li>
    				<li>Register</li>
    			</ul>	
    		
    		</div>



    • Edited by Gerryts Saturday, May 12, 2012 11:24 AM
    Saturday, May 12, 2012 11:19 AM

Answers

  • Hi Gerryts,

    Solution 1) - You’re missing a unit of measurement for the top and left property values (though left’s being '0' it needn't one, because 0 is the same in any measurement).

    Try with : 

    top: 355px; left: 0;

    In general you should also consider using the margin property before position.

    Solution 2) -  Instead of given top and left you can definemargin. In that case there is no need to set the position to absolute.

    Check this example

    margin:50px 0 0 30px;
    which means:
    top margin is 50px, right margin is 0px, bottom margin is 0px, left margin is 30px


    Regards, http://shwetamannjain.blogspot.com

    • Proposed as answer by Shweta Jain (Lodha) Sunday, May 13, 2012 4:57 AM
    • Marked as answer by Gerryts Sunday, May 13, 2012 10:13 AM
    Sunday, May 13, 2012 4:57 AM

All replies

  • Wrong forum.  Post @ http://forums.asp.net.

    Jose R. MCP

    Saturday, May 12, 2012 9:51 PM
  • Hi Gerryts,

    Solution 1) - You’re missing a unit of measurement for the top and left property values (though left’s being '0' it needn't one, because 0 is the same in any measurement).

    Try with : 

    top: 355px; left: 0;

    In general you should also consider using the margin property before position.

    Solution 2) -  Instead of given top and left you can definemargin. In that case there is no need to set the position to absolute.

    Check this example

    margin:50px 0 0 30px;
    which means:
    top margin is 50px, right margin is 0px, bottom margin is 0px, left margin is 30px


    Regards, http://shwetamannjain.blogspot.com

    • Proposed as answer by Shweta Jain (Lodha) Sunday, May 13, 2012 4:57 AM
    • Marked as answer by Gerryts Sunday, May 13, 2012 10:13 AM
    Sunday, May 13, 2012 4:57 AM
  • Thanks for the advice
    Sunday, May 13, 2012 10:14 AM