Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CSS & HTML help needed: a:hover,a:active affecting whole page

Featured Replies

Hi guys,

 

I'm new to everything around CSS and HTML. I've been dealing with this project at school where we learn some basic css.

 

Mainly I have two issues:

 

1. Somehow the ID " #nav a:hover,a:active" is affecting all links on my page. Whats wrong?

2. My logo is not displaying in IE, but displays properly in chrome and firefox. What is it that IE don't like and are there any workarounds?

 

(3. Any other things to point out? Maybe you have some tips for solving problems better.)

 

CSS: http://pastebin.com/QEErD7Cz

 

 

HTML: http://pastebin.com/sJ69yrD1

 

I'm also uploading all the code files for those of you who prefer that.

 

Looking forward to some feedback. Cheers!

project-files.zip

Edited by pedRs

Where you have styles like this:-

#nav a:link,a:visited {
#nav a:hover,a:active { }

you must repeat the id or class:-

#nav a:link, #nav a:visited {
#nav a:hover, #nav a:active { }

 

There may be other places where you need to do this, otherwise a simple a:active {} will apply everywhere.

 

I can't see anything wrong with this background to a p tag, but check the path and case, the image filename should be in lower case:

#logo p{
text-decoration: none;
border: 0;
margin: 0;
padding: 0;
height: 63px;
width: 234px;
background: url(images/logo.png) no-repeat 0 0;
}

You could try moving the width, height and background image to the #logo style instead of the #logo p style.

 

I think the link won't work because you have pushed the "a" tag off left with -9999px. This may work:-

<p><a href="index.html"><span>2ISFA labs</span></a></p>

CSS:

#logo a{
display: block;
height: 63px;
/*text-indent: -9999px;*/
}

#logo a span{
display: block;
height: 63px;
text-indent: -9999px;
}

 

Edit: my comment about adding the span tag is unnecessary if you use text-indent, but is necessary if you use margin-left: -9999px for the "a" tag instead.

Edited by Wickham

  • Author

Where you have styles like this:-

#nav a:link,a:visited {
#nav a:hover,a:active { }

you must repeat the id or class:-

#nav a:link, #nav a:visited {
#nav a:hover, #nav a:active { }

 

There may be other places where you need to do this, otherwise a simple a:active {} will apply everywhere.

 

Thank you Wickham! This saved my day seas%20%288%29.gif

The problem with IE not displaying the logo also disappeared. The URL works fine even without any changes. Thanks again!

Good spot Wickham,

 

a little add in for you, when it comes to browser compatibility, we all know that internet explorer is the bain of a web designers life.

 

If you are having cross browser issues, validate your website with xhtml and css validator. it will list the problems in your code that are not at a good web standard, then once you have fixed them you should have no browser issues.

 

Hope thats helpful for the future!

 

Craig

  • Author

Good spot Wickham,

 

a little add in for you, when it comes to browser compatibility, we all know that internet explorer is the bain of a web designers life.

 

If you are having cross browser issues, validate your website with xhtml and css validator. it will list the problems in your code that are not at a good web standard, then once you have fixed them you should have no browser issues.

 

Hope thats helpful for the future!

 

Craig

 

Great tips! Thank you

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.