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.

Is it necessary to have validated css code?

Featured Replies

I was wondering what the general consensus was on css code, I agree that validating HTML the correct tools (eg. http://validator.w3.org/) is pretty essential, but I was wondering if it is essential to do the same with css?

 

Are the constraints too narrow or is it good to use a tool (eg. https://jigsaw.w3.org/css-validator/) to validate css?

 

For example, if it comes up with the error - Property webkit-box-shadow doesn't exist, should I delete the code?

 

Over to you..

You can ignore "errors" caused by vendor prefixed rules, eg -webkit-something, -moz-something , they are ok to use but the validator doesn't observe them because they're not part of the official spec.

 

Any other errors I'd pay attention to because they can cause odd display issues!

CSS lint can be useful, not for validation but for giving you feedback on how well your css is written. Similar tool JsHnt for JavaScript. I use jsHint on all my projects, very useful.

 

The W3 validators are a bit problematic in that a lot of the css stuff we now use is not yet an official standard (Although almost all will be... eventually) so you get errors that shouldn't be.

 

HTML validation is more important because invalid markup can have an impact on semantics (which affect SEO and accessability (screen readers). Invalid css will be easy to spot by visually testing in browsers.

CSS lint can be useful, not for validation but for giving you feedback on how well your css is written. Similar tool JsHnt for JavaScript. I use jsHint on all my projects, very useful.

 

The W3 validators are a bit problematic in that a lot of the css stuff we now use is not yet an official standard (Although almost all will be... eventually) so you get errors that shouldn't be.

 

HTML validation is more important because invalid markup can have an impact on semantics (which affect SEO and accessability (screen readers). Invalid css will be easy to spot by visually testing in browsers.

 

 

So much this. When you are doing very progressive stuff with your css, it is really hard if not 100% impossible to validate your CSS and your HTML. Take for example if you are doing a lot of vendor prefixed stuff on your css. It may be perfectly fine css, but it won't validate. Using grunt with your linters automatically when you save can spot problems as you write your code and prevent problems down the line.

 

 

So much this. When you are doing very progressive stuff with your css, it is really hard if not 100% impossible to validate your CSS and your HTML. Take for example if you are doing a lot of vendor prefixed stuff on your css. It may be perfectly fine css, but it won't validate. Using grunt with your linters automatically when you save can spot problems as you write your code and prevent problems down the line.

 

Indeed, the jsLinters will throw an error and halt the grunt task, while outputting the error message to the terminal screen. useful if you say have forgotten to declare a variable which results in it being a global.. which of course is terrible behaviour but can be hard to spot.

It may be ignorance on my behalf, but I have never tried to validate my code with w3 etc.

 

I remember people used to put the w3 validated icon on their page... :lol:

 

Multitude of browser and device testing is all I do along with modernzr etc if needed.

I have to admit I do sometimes forget to validate all my html, but it's a good practice to have, because the browsers often insert missing closing tags and things like that, so we'd never know that our markup is broken, the issue being is that these kind of fixes are a bit random because there is no set standard for it so cannot be 100% trusted to work across the board.

 

Sub-standard markup will affect the SEO however, by how much I do not know, but Google does prefer to see properly structured markup. There could also be issues with screenreader technology and how they handle broken markup.

 

In short we should try and always validate our markup and make it a habit. the CSS validation though, I wouldn't bother.

Indeed, the jsLinters will throw an error and halt the grunt task, while outputting the error message to the terminal screen. useful if you say have forgotten to declare a variable which results in it being a global.. which of course is terrible behaviour but can be hard to spot.

You know one one these days we are going to have to work on a project together even if just for fun. We find ourselves agreeing with each other on almost every topic we both comment on. I find it hilarious.

I'm sure something will come up one day. I get quite a few requests from people wanting projects and stuff but I'm always so busy I don't know where I'd find the time, I barely have time to maintain my blog, I think we're all kinda in the same boat though, we find time if a project interests us enough.

Sub-standard markup will affect the SEO however, by how much I do not know, but Google does prefer to see properly structured markup.

 

I 'think' they respond to markup in a similar way to grammar ... it won't kill a site but you will rank slightly higher than an exact replica who has grammar (or in this case mark-up) errors.

Using Scout for Compass + Sass will give you errors if you type anything wrong, plus can add all your vendor prefixes for you by using mixins. But alas I guess the conversation was about CSS and not Sass.

 

Php Storm is a very good tool (though it costs) that will warn you if you don't close html tags or forget a semi colon, or colon on your CSS. A good development tool can make things a lot easier so you don't ever end up publishing broken html/css.

As with all tools though you will only catch syntax errors and not logic errors.

Using Scout for Compass + Sass will give you errors if you type anything wrong, plus can add all your vendor prefixes for you by using mixins. But alas I guess the conversation was about CSS and not Sass.

 

Php Storm is a very good tool (though it costs) that will warn you if you don't close html tags or forget a semi colon, or colon on your CSS. A good development tool can make things a lot easier so you don't ever end up publishing broken html/css.

As with all tools though you will only catch syntax errors and not logic errors.

 

Have you tried Grunt.js? It has a task called autoprefixer which automatically throws in the vendor prefixes into your css, you can use grunt tasks to compile your Sass, concatenate , Javascript files, basically pretty much any task that can be automated has been through grunt.js Plugins, kind of making compass redundant.

The good thing with grunt is it's a part of the NPM repository so continually updated, to update all of your tasks to latest versions you simply hit 'npm update' in the terminal.

Edited by rbrtsmith

I have not tried grunt.js. I will definitely look into it. The place I just interviewed for this week and have my final interview Tuesday told me their flow is with smacss, compass, sass, and drupal. I'm wasn't super familiar with these three tools. I just picked them up this week, but I was able to build mockups/demo pages for two freelance clients in those tools within a really short time.

 

I will definitely give grunt a look into once I am familiar with the ins-and-outs of this new process they have asked me to learn.

Grunt + Compass + Sass is a pretty cool combination, there is tasks for grunt which automated SASS compiling and if you are on a mac you can get it automating most of your workflow with some bash scripts too.

you can run Grunt on windows too. I have little use for compass since I went with grunt. You can also get grunt to automate bash scripts too, I have grunt automating my Jekyll build routine when I am working on my blog.

you can run Grunt on windows too. I have little use for compass since I went with grunt. You can also get grunt to automate bash scripts too, I have grunt automating my Jekyll build routine when I am working on my blog.

 

I just mean MacOS because of the bash scripts.

Interestingly I'm actually learning some Node right now, and one of the things you can do with node is create bash scripts in javaScript. I run Mingw32 on my windows machine to simulate a unix command line :)

For example, if it comes up with the error - Property webkit-box-shadow doesn't exist, should I delete the code?

 

Over to you..

When it comes to vendor prefixes it's good practice to always use the W3C standard property as your last line even if the standard is not implemented yet. That way your code will be compatible with future browser versions and the errors will be ignored.

div { 
  -webkit-box-sizing: border-box; /* Vendor prefix */
  -moz-box-sizing: border-box;    /* Vendor prefix */
  box-sizing: border-box;         /* W3C standard ALWAYS USE THE STANDARD PROPPRTY LAST*/
}

It's worth noting that a vast majority of vendor prefixes are no longer needed. box-shadow and box-sizing aren't, unless you're targeting browsers that have under 0.1% usage.
As others have suggested make use of autoprefixer or check on http://caniuse.com if your unsure.

Interestingly I'm actually learning some Node right now, and one of the things you can do with node is create bash scripts in javaScript. I run Mingw32 on my windows machine to simulate a unix command line :)

 

Nice and here i have been writing all my own CMDs. I pretty much made a user folder called globals registered its path in the Windows global variables %path% and then added linux/mac commands via there so I could you know do the cool stuff like VIM anything from anywhere and never touch my mouse when coding.

 

Right now I'm trying to look into using bash/batch to generate blueprints hierarchies from a text file into an ember cli project. It could increase my workflow dramatically, but I'm still a nub at bash/batch string parsing.

Edited by lesshardtofind

 

Nice and here i have been writing all my own CMDs. I pretty much made a user folder called globals registered its path in the Windows global variables %path% and then added linux/mac commands via there so I could you know do the cool stuff like VIM anything from anywhere and never touch my mouse when coding.

 

Right now I'm trying to look into using bash/batch to generate blueprints hierarchies from a text file into an ember cli project. It could increase my workflow dramatically, but I'm still a nub at bash/batch string parsing.

 

I don't have any saved CMDs, but I can see how it could be very useful. I still use the mouse quite often, It's just habit I guess but as time goes on I find I spend more and more time in the terminal. Have played around with VIM and use it when I'm working on live code on the server, but I could do with finding the time to get more productive with VIM, I know it can be lightning fast once you know the common commands.

 

The Node stuff for bash scripts was just a part of the tutorial I was following, I haven't actually used them for anything useful yet. It's gonna take some time to improve my Node ability due to the front-end being my comfort zone. I'm certainly excited by the possibilities with Node, Web Sockets and RCT :)

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.