Solved

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

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

679 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