How do I use css to find my panel's ID?

If my HTML looks like this:

<%@ Page Title="" Language="C#" MasterPageFile="Site.master" AutoEventWireup="true"
    CodeFile="UARForm.aspx.cs" Inherits="UARForm" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link type="text/css" rel="stylesheet" href="Styles/UARForm.css" />
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <asp:Panel ID="pnlManager" runat="server">
    <asp:Panel ID="pnlHR" runat="server">
        <div class="divHR" id="divHR">
            <asp:Label ID="lblHRHeader" runat="server" Text="Approval Tracking:" />

Open in new window

why does this:

    margin: 20px 0 0 0;

 not work to add 20px to the top margin?
Michael SterlingWeb Applications DeveloperAsked:
Who is Participating?
GaryConnect With a Mentor Commented:
Because you have runat=server on the element which will change the ID.
Add a class to the element and use that for the css targetting or remove the runat attribute
Michael SterlingWeb Applications DeveloperAuthor Commented:
Thank you. Will do. Before I do that, what adverse affects will that have on my panel, that I need to be concerned about? Removing the "runat" attribute?
Won't have any effect for a panel.
Michael SterlingWeb Applications DeveloperAuthor Commented:
Thank you.
Michael SterlingWeb Applications DeveloperAuthor Commented:
Thanks for your input.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.