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.

making this code valid...

Featured Replies

Hey all

 

I'm adapting a gallery by Stu Nichols - found here but after doing all the work have discovered that the code doesn't validate. I have the following within my <head> tag

 

<head>

<link href="css_pictures.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" media="all" type="text/css" href="simple_css/simple.css" />

<!--[if IE]>
<link rel="stylesheet" media="all" type="text/css" href="simple_css/simple_ie.css" />
<![endif]-->

<script src="simple_js/simple.js" type="text/javascript"></script>
<noscript>
<link rel="stylesheet" media="all" type="text/css" href="simple_css/simple_noscript.css" />
<link rel="stylesheet" media="all" type="text/css" href="simple_css/simple_ie_noscript.css" />
</noscript>

</head>

 

and it's the noscript stuff that causes the problem. How can I get this to validate?

 

Link to my version here

Hm... NOSCRIPT not allowed in the HEAD... wonder why that is. I'd be tempted here to ignore the validation. It just seem sensible to me that NOSCRIPT should be allowed in the HEAD.

 

Validation isn't alpha and omega. If you got a good reason to break it then break it.

 

I just presently discovered that wrapping INS or DEL around a LI element doesn't validate. Which to me makes no sense. If a list item is removed then I want to indicate that the whole LI element is gone, not just the content. If I place the INS or DEL inside the LI elements the bullets are still visible. I think it's one of them things where the recommendation didn't cover all possible options.

 

Don't get me wrong though, I'm a strong supporter to follow the standards, but I also believe that somethings things need to break. The standards is after all, recommendations.

i agree with TT here, but if you MUST have the code validate, then you need to think in reverse.

 

Instead of doing a "noscript" you need to do a "script". The script will import the stylesheets into the document onload, and these stylesheets will overwrite the always-defined noscript CSS files.

 

Not sure how to achieve this off the top of my head, but it is the best way IMO.

The noscript element is really only used for displaying text content when JavaScript is disabled ( I think), so trying to insert a stylesheet is probably why it doesn't validate.

i agree with TT here, but if you MUST have the code validate, then you need to think in reverse.

 

Instead of doing a "noscript" you need to do a "script". The script will import the stylesheets into the document onload, and these stylesheets will overwrite the always-defined noscript CSS files.

 

Not sure how to achieve this off the top of my head, but it is the best way IMO.

 

I was thinking the same. Reversing the thinking. But As you say, how can you easily override whole sets of stylesheets? I wasn't sure myself. ... I wonder... what would happend if the script onDOMready removes the LINK elements to the stylesheets? ... will the browser then unload those styles again?

Eskymo, could you explain what you're trying to achieve? It could be that you don't need to import extra stylesheets...?

  • Author

well it took me ages to find a css based thubmnail gallery that worked the way I wanted it to and that worked OK on a mac as weel - this involved using javascript...so I wanted to make sure that the gallery would still work if javascript was deisabled, so that's why I chose this one as it offers an 'noscript' option in that you can just rollover the thumbnails and still see the larger image. If there's a way of just getting rid of tha javascript and not having to bother with it, then I think I'll do that.

 

Thanks

I had a look at the site with JS disabled. What if you made the image change with :focus instead of :hover? I think it'd behave much like the JS version then. But it depends on how much backwards compatibility you require.

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.