asp.net web page missing top and left properties

Simon 466 Reputation points
2024-03-19T18:33:57.3666667+00:00

by Designing a web page

in the "View Markup"

is it posible to set the top and left

 <asp:Panel ID="Panel7" runat="server" BackColor="Transparent" Height="858px" Width="2186px" Left="152px" Top="70px" Direction="LeftToRight">

it is not making an error

then in the View Designer

is mising the properteis of "top" and "Left"

how is posible to set the position of a panel

Developer technologies ASP.NET Other
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 60,161 Reputation points
    2024-03-19T19:30:28.24+00:00

    There is no such thing as a top or left attribute on HTML elements. These are positioning values and are related to the styling of the control. Ideally you should be managing all this in the CSS for your site and not using hard-coded positioning as it isn't responsive.

    Having said that, to set the top left position of an element you must apply styling.

    <asp:Panel Style="top: 10px; left: 10px"></asp:Panel>
    

    Be aware that Content Security Policies generally do not allow inline CSS because they are vulnerable. Therefore the preference is to put the styling into CSS and then mark the panel as using the CSS class instead.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Simon 466 Reputation points
    2024-03-19T21:23:09.7333333+00:00

    I tried using your solution (see code below) and got no results.

    <asp:ListBox ID="ListBox1" runat="server" Style="Left: 0px; Top: 0px" Height="153px" Width="239px" Rows="8" SelectionMode="Multiple" ToolTip="Testing"></asp:ListBox>

    It does not move the Listbox to the top.

    Maybe I did not understand your response. Please explain.


  2. Simon 466 Reputation points
    2024-03-19T22:18:11.3066667+00:00

    Michael Taylor

    Thanks A milion

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.