Solved

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

Posted on 2014-09-04
5
115 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now