Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 25, 2012 11:16 AM by saeed_saedvand
Member
10 Points
41 Posts
Dec 23, 2012 10:18 AM|LINK
i try my best to apply css on label but fail, here is the html code and css
<div class="divacademic" id="divlbl" style="display:none" > <div class="ul"> <div class="li"><asp:Label ID="lbledu" CssClass="lblacadhead" Text="Education level" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblexam" CssClass="lblacadhead" Text="Exam Name" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblInstitute" CssClass="lblacadhead" Text="Institution or Board or University" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblObtDate" CssClass="lblacadhead" Text="Obtaining Date" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblmarks" CssClass="lblacadhead" Text="O.Marks/T.Marks" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblDivision" CssClass="lblacadhead" Text="Division" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblPercentage" CssClass="lblacadhead" Text="%age or CGPA" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblSubject" CssClass="lblacadhead" Text="Major Subjects" runat="server"></asp:Label></div> </div> </div>
css here:
#lbledu { width:104px; }
i just to width the label
All-Star
27587 Points
4122 Posts
Dec 23, 2012 10:31 AM|LINK
try this in the css
.lblacadhead { width:104px; }
88 Points
35 Posts
Dec 23, 2012 11:19 AM|LINK
Kindly Emclose the Label within paragraph tag and apply the class to the paragraph. You are good to go.
Sample HTML
<p class="label" > <asp:Label ID="lblDisplay" CssClass="label" Text="God is good" runat="server"></asp:Label></p>
The CSS
.label { width:300px; font-family:Verdana; color:Red; }
112168 Points
18255 Posts
Moderator
Dec 23, 2012 12:05 PM|LINK
Maybe try that css on the surrounding div.
Star
14406 Points
2449 Posts
Dec 24, 2012 05:26 PM|LINK
Hi,
make sure label ID is not changing after render.
try this CSS:
#lbledu { width:104px; display:inline-block; /* or try, block */ }
20155 Points
3328 Posts
Dec 25, 2012 05:18 AM|LINK
You need to add display:block; to the CSS inorder to set the width of SPAN tag(Since Label tag is rendered as SPAN)!
.lblacadhead { width:104px; display:block; }
Hope it helps u...
408 Points
74 Posts
Dec 25, 2012 11:16 AM|LINK
You should use its parrent too in css like below:
.li #lbledu{ width: 104px; }
waleedshah
Member
10 Points
41 Posts
problem with label css
Dec 23, 2012 10:18 AM|LINK
i try my best to apply css on label but fail, here is the html code and css
<div class="divacademic" id="divlbl" style="display:none" > <div class="ul"> <div class="li"><asp:Label ID="lbledu" CssClass="lblacadhead" Text="Education level" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblexam" CssClass="lblacadhead" Text="Exam Name" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblInstitute" CssClass="lblacadhead" Text="Institution or Board or University" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblObtDate" CssClass="lblacadhead" Text="Obtaining Date" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblmarks" CssClass="lblacadhead" Text="O.Marks/T.Marks" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblDivision" CssClass="lblacadhead" Text="Division" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblPercentage" CssClass="lblacadhead" Text="%age or CGPA" runat="server"></asp:Label></div> <div class="li"><asp:Label ID="lblSubject" CssClass="lblacadhead" Text="Major Subjects" runat="server"></asp:Label></div> </div> </div>css here:
#lbledu { width:104px; }i just to width the label
sreejukg
All-Star
27587 Points
4122 Posts
Re: problem with label css
Dec 23, 2012 10:31 AM|LINK
try this in the css
.lblacadhead { width:104px; }My Blog
ajafik
Member
88 Points
35 Posts
Re: problem with label css
Dec 23, 2012 11:19 AM|LINK
Kindly Emclose the Label within paragraph tag and apply the class to the paragraph. You are good to go.
The CSS
.label
{
width:300px;
font-family:Verdana; color:Red;
}
MetalAsp.Net
All-Star
112168 Points
18255 Posts
Moderator
Re: problem with label css
Dec 23, 2012 12:05 PM|LINK
Maybe try that css on the surrounding div.
raju dasa
Star
14406 Points
2449 Posts
Re: problem with label css
Dec 24, 2012 05:26 PM|LINK
Hi,
make sure label ID is not changing after render.
try this CSS:
#lbledu { width:104px; display:inline-block; /* or try, block */ }rajudasa.blogspot.com || blog@opera
roopeshreddy
All-Star
20155 Points
3328 Posts
Re: problem with label css
Dec 25, 2012 05:18 AM|LINK
Hi,
You need to add display:block; to the CSS inorder to set the width of SPAN tag(Since Label tag is rendered as SPAN)!
.lblacadhead { width:104px; display:block; }Hope it helps u...
Roopesh Reddy C
Roopesh's Space
saeed_saedva...
Member
408 Points
74 Posts
Re: problem with label css
Dec 25, 2012 11:16 AM|LINK
You should use its parrent too in css like below:
.li #lbledu{ width: 104px; }Saeed Saedvand