Arianule
Arianule

Reputation: 9053

Positioning of an element using CSS in ASP.NET

I am learning about CSS and want to apply it in ASP.NET. I am struggling with the general positioning of the elements.

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;
}

In other words the menu element stays more or less in the top left hand corner no matter what I do. What is the best why to manipulate the position of the various elements on an ASP.NET form?

This is the markup for .menu.

<div class="menu">
    <ul>
        <li>Add Books</li>
        <li>Review Books</li>
        <li>Register</li>
    </ul>
</div>

Upvotes: 0

Views: 127

Answers (2)

Libin
Libin

Reputation: 2462

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; means

top margin is 50px,

right margin is 0px,

bottom margin is 0px,

left margin is 30px

Upvotes: 1

reisio
reisio

Reputation: 3242

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.

Upvotes: 2

Related Questions