We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Why isn't my style class working?

lapucca
lapucca asked
on
Medium Priority
296 Views
Last Modified: 2012-06-21
Hi, I'm using asp.net 3.5
<span id="resultLabel" class="ResultTitle" style="font-size: xx-large">Find a Doctor Search Results<br /><br /></span>
Unless i have the font-size here otherwise font is small.  The class i defined here is not being applied at all.  How to fix this?  thnks.
PhysicianResults.css
SearchPhysicians.ascx
SearchResults.html
Comment
Watch Question

Top Expert 2011

Commented:
It is probably because you are giving the Span both an ID AND and a class.

Try adjusting your CSS to look like the following:

.ResultTitle, #resultLabel {
	border-bottom: 3px double;
	font-size:xx-large; 
	color:Gray;
}

Open in new window


Alternatively you might simply need to tell your class that it is a span.

span.ResultTitle, span#resultLabel {
	border-bottom: 3px double;
	font-size:xx-large; 
	color:Gray;
}

Open in new window


I personally am not a big fan of spans. Anytime I use them I put the CSS inline. Maybe try using a div instead.
Top Expert 2010

Commented:
Hi lapucca,
I have tested your code and it seems to work fine and the CSS is working.

Did you ensure that your CSS is in the correct path/folder and is being loaded? you currently have it inside CSS folder.
You can ensure if it is being loaded by viewing the page in Firefox, vieweing the source and checking the path of the "PhysicianResults.css" and seeing if it's correct.

Also you seem to be loading the CSS inside the <body> section where it should be within the <head> section
Juan OcasioContinuous Process Improvement Lead
CERTIFIED EXPERT

Commented:
is this your complete css file?  Where is the id defined?  Also make sure the class is defined after the id

Author

Commented:
Hi Rem, If you remove the inline font-size then it won't work.  Also, the doesn't give me the double underline either.
Iocassio, what id are you ref?
Thank you.
Juan OcasioContinuous Process Improvement Lead
CERTIFIED EXPERT

Commented:
id="resultLabel"  Where is this defined?
Top Expert 2010

Commented:
Hi lapucca,
Have you made sure the CSS file is being correctly loaded as I mentioned earlier? it seems that the whole file is not being loaded.

Please double check its path is correct, try browsing with Firefox, view page source "CTRL+U" then click the "PhysicianResults.css" link in the source code to check if it displays your CSS and that it's correct and not a broken link.

Cheers!
Obadiah ChristopherDeveloper User Interface
CERTIFIED EXPERT

Commented:
"id="resultLabel" where is this defined?"What are you trying to say?
Continuous Process Improvement Lead
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
For asp.net controls Id is just there.  I didn't know if I use it for span then it has to be defined somewhere?  I thought the css file has the class name defined which was used in span then it should be good enough.  
I then removed the span and just use an asp.net label control.  Still nothing is working with css. The CSS folder was under the usercontrol folder, I moved it to the root and it still doesn't work.  
Rem, I did check page source view and in both locations the css file was not loaded.  I wonder if this is because this css file is ref in a user control that is used in  this aspx file.  Attached is a screen shot of my current folder tree in vs.  Maybe one of you can help me on how to ref this css file so it would be loaded.  Thank you.
CSS.jpg
Top Expert 2010
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thank you all.  I think it's the user control that's making this more complicated than it should be.  I'm just going to include the style in the code, <style type="text/css">  that seems to work for sure.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.