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.

messy code

Featured Replies

I've cleaned the code of a new site i've built and made sure all the elements are indented properly, but when i view the code in the browser, some of it is incorrectly spaced and not indented as it should be so it looks like ive not bother writing my code properly. Anyone what causes this??

Have you emptied your cache first of all?

Also what are you creating your code with?

It could be a problem with mixing tabs/spaces which can cause inconsistent layouts. However honestly I wouldn't worry about how your code appears. All web browses care about is that your code is valid (x)html, how the white-space is laid out is irrelevant. In fact all that whitespace is extra data that needs to be downloaded and thus slows your site down a tiny amount. With gzip it really isnt anything you need to worry about but big sites like google, if you view their source code you'll see there's almost no whitespace at all to speed up download times.

  • Author

Ok cool cheers guys, just would be nice to know for next time whats causing this so i dont do it again', so you think it might be the fact i might be mixing spaces and tabs or the fact i havent cleared my cache? I havent cleared out my cache no, i dont actually know how to do this...

 

...and i write the code using Dreamweaver...

I find my code doesn't tend to look exactly like I wrote it but the content is the same which is as James said all that matters.

 

If you haven't cleared your cache you may still be viewing your old code though? Depends which browser you use to what you have to do to clear the cache... but generally there is an option in preferences somewhere to clear cache or browsing data.

  • Author

Ok thats cool because its my new code just things like the nav <li> are no longer in a straight line, i just wondered if there was anything i could do so this doesnt happen as im not sure if an employer would mark you down because of this...

Technically you should have a nicely spaced out version (for your use) then a completely condensed version for the web. The web version should have no line breaks or spaces (within the code, obviously need spaces in paragraphs etc.) - this reduces the file-size. With the usual .html files this isn't generally necessary but is the reasoning behind condensed JS scripts or long-length, generated pages such as Google search pages or Facebook pages. Some code generated by PHP/ASP/etc. will lack these line spaces/indents too. With our constantly increasing Internet/3G speeds and decreasing price of bandwidth, this isn't too important anymore, not with the relatively small sites we make.

 

An employer marking you down for spacing code would be an employer in need of some treatment. If anything, they'd want to check it validates - but even that may not reflect the quality of work. You can have a completely invalid website which is highly functional and completely cross-browser compatible. Check out Microsoft.com in the W3C validator ;)

  • Author

Yeah excellent, good advice cheers man, and ive not got round to validating it yet i will get round to that when the site is finished...always have a few supprises waiting for you there...:)

 

Thanks again

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.