Solved

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

Posted on 2014-09-04
5
120 Views
Last Modified: 2014-09-04
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>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <asp:Panel ID="pnlManager" runat="server">
    </asp:Panel>
    <asp:Panel ID="pnlHR" runat="server">
        <div class="divHR" id="divHR">
            <asp:Label ID="lblHRHeader" runat="server" Text="Approval Tracking:" />
        </div>
    </asp:Panel>
</asp:Content>

Open in new window


why does this:

#pnlHR
{
    margin: 20px 0 0 0;
}

 not work to add 20px to the top margin?
0
Comment
Question by:mikesExpertExchange
  • 3
  • 2
5 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40303976
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
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 40304009
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?
0
 
LVL 58

Expert Comment

by:Gary
ID: 40304026
Won't have any effect for a panel.
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 40304105
Thank you.
0
 
LVL 1

Author Closing Comment

by:mikesExpertExchange
ID: 40304106
Thanks for your input.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question