- This topic is empty.
-
AuthorPosts
-
September 18, 2014 at 3:09 pm #183542
Everton
ParticipantHello
I have this in the <head> tags of the Site.master file in a ASP.NET project:
<style type="text/css"> .nav a:link { color: #ffffff; text-decoration: none; } .nav a:hover { color: #ffffff; text-decoration: underline; } </style>
Between the <body> tags I have this:
<AnonymousTemplate> <ul class="nav navbar-nav navbar-right"> <li><a runat="server" href="~/Account/Register">Register</a></li> <li><a runat="server" href="~/Account/Login">Log in</a></li> </ul> </AnonymousTemplate>
When I preview my project – I have cleared the browser cache – the two links, Register and Log in, are unaffected.
Is my script correct, please, and if it is why wouldn’t the browser respond to the styling I have given my Web page?
I can’t put this online because ASP.NET projects are compiled and the CSS files are not visible.
Thanks!
September 18, 2014 at 4:58 pm #183547Anonymous
InactiveTry adding !important after text-decoration value
.nav a:link { color: #ffffff; text-decoration: none !important; } .nav a:hover { color: #ffffff; text-decoration: underline !important; }
I noticed that you are applying text-decoration to unvisited links. If you haven’t visited that link, the style wont apply. So click on it and see what happens.
:link pseudo styles links that haven’t been clicked.
September 18, 2014 at 5:05 pm #183548Everton
ParticipantI have copied and pasted that in my Master file and then in my Register.aspx file but it doesn’t change anything.
September 18, 2014 at 5:36 pm #183549Everton
ParticipantI have asked on the Microsoft ASP.NET forum and a couple of moderators there have said the issue is CSS related?!
September 18, 2014 at 6:11 pm #183550__
ParticipantI can’t put this online because ASP.NET projects are compiled and the CSS files are not visible.
If you can look at the results in a browser, you can look at the generated CSS.
The best approach is to make a reduced test case, e.g., on codepen. Find the minimum amount of code that demonstrates your problem.
The code you posted does this.
September 18, 2014 at 6:23 pm #183551Everton
ParticipantI have a test site here
so I know it works. Just can’t get it to work in Visual Studio.
Yes, I can run Inspector in IE and post back, if that’s OK?
September 18, 2014 at 6:34 pm #183552__
ParticipantIs the result any different in IE? I’m looking at your test site in FireFox, and it displays exactly as expected. What do you expect it to look like?
I know it works. Just can’t get it to work in Visual Studio.
To clarify, are you having problems in a browser or only in Visual Studio?
In the former case, I’ll be happy to help you investigate further.
In the latter case, I say it’s not a problem. Just a reminder that you should use a real browser for development, and not some pricey piece of software that pretends to be one. No one will ever use Visual Studio to visit your finished website.
September 18, 2014 at 6:44 pm #183553Everton
ParticipantI expect the two links to be in white and when I hover the mouse over, I expect them to be underlined.
It doesn’t work via IE or Safari.
Not sure what you mean by this: ‘use a real browser for development, and not some pricey piece of software that pretends to be one’.
‘No one will ever use Visual Studio to visit your finished website’.
Not sure what you mean, sorry.
Enjoy your evening.
September 18, 2014 at 7:31 pm #183555__
ParticipantNot sure what you mean by this: ‘use a real browser for development, and not some pricey piece of software that pretends to be one’.
After reading your earlier post, I wasn’t sure if you were describing a problem you saw in a browser or in Visual Studio. I was pointing out that one of those situations matters, and the other doesn’t really. But you say it’s an IE + Safari problem, so this distinction is not strictly relevant.
I expect the two links to be in white and when I hover the mouse over, I expect them to be underlined.
This is what I see (in Firefox, chrome, and IE11), though note (as @htmlcinco mentioned) that links you have already visited will not necessarily be white, since the default for
:visited
links in most browsers is a purplish color. -
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.