1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

The Most Common HTML and CSS Mistakes to Avoid

Discussion in 'CSS' started by anu_smart, Jan 10, 2016.

  1. #1
    The Most Common HTML and CSS Mistakes to Avoid:
    The main purpose of this thread is to point out the common mistake made in both HTML and CSS and help them correct in the future. Hope that these information are helpful.

    HTML Mistakes:
    Following article is going to explain clearly/briefly about the Common mistakes made in the HTML.

    1. Forgetting to close a tag:
    This mistake is most common for beginners. Closing Tags such as divs, strong tags, and links are required. Some tags require a slash tag for closing.

    2. Incorrect DOCTYPE:
    It is necessary to declare a correct DOCTYPE declaration for HTML. So you should declare what type of HTML you are using at the beginning itself.

    3. Improperly nesting tags:
    The open and close tags should be in the correct order. Each division should be opened and closed properly without involving other divisions in it.

    4. Capitalizing tags:
    You should not use capitalized tags in your code, because it will not be validated. So, you should use only lowercase characters.

    5. Forgetting to open or close quotes:
    In HTML, the open and close double quotes must be placed correctly or it will not function properly. This is most common mistake for beginners.

    6. Using Inline Styles:
    You should not use inline styles since it will end up with an error message. Use external stylesheet to stylize your items. Editing and adding styles is an easier technique.

    7. Not Encoding Special Characters:
    Characters such as “ &“, etc., must be shown in proper HTML code for the characters.

    8. Confusing classes and Ids:
    The items are grouped with classes which will be called several times on a single page. Classes can be link style which will be called for multiple times. Like the headers, Ids are the items that are called only once. We use classes and ids in unnecessary places. Try to minimize the amount of classifications.


    CSS MISTAKES:
    Following article is going to explain clearly/briefly about the Common mistakes made in the CSS.

    1. Forgetting to close things properly:
    Every item or div which are called in should start and end with the opening and ending curly brackets. End the styles with a semicolon. There is no need of semicolon for the last declaration within an item.

    2. Not using Global Styles:
    The paragraphs and heading styles should be styled globally. This idea will reduce the chances of mistakes and will minimize the size of code.

    3. Not using Unique names for Ids and Classes:
    The names and keywords should be unique so that there will be no problem in identifying the items.

    4. Not using shorthand code:
    Use shorthand code to compress your code which will be helpful for speeding the loading time and easy editing. You can use shorthand code for declarations such as font, padding, border, margin, etc.

    5. Not using Shortened Color Declarations:
    You can condense the hexadecimal numbers such as #fffff and #00000 to #fff and #000. This is one of the ways to condense your code length.

    6. Incorrectly using Positioning:
    It is tough to understand the positions for beginners with CSS. Your choices are static, relative, absolute and fixed. The default option is static and it will be positioned according to page flow. You can place an item wherever you want using Absolute. The values for the absolute will depend upon the parent item. Fixed is used to make stay an element in the page even if the user scrolls down the page. But these options should not used excessively since it won’t look good.

    7. Validate:
    The errors in your code can be reduced by validating your HTML and CSS files. The problems are identified by the validator and so it will allow you to adjust your code.

    I hope that I have given all the common mistakes. If I have missed out any please add those in the comment and also correct my mistakes in this thread.
     
    anu_smart, Jan 10, 2016 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,498
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    Really? What error messages are you referring to?
    The advice is good, I'm just not sold on the reason.
    If you are that concerned about the size of your page there are other things you should be looking for before you munt your colours like that.
     
    sarahk, Jan 10, 2016 IP
  3. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #3
    While the tips are mostly good, I'm gonna point out a couple things that are... mostly wrong

    No. As long as you're using HTML, and not XHTML, no tags needs a slash (or rather />) for closing. They're either self-contained (like <input> or need a closing tag, like <div></div>
    While this is correct, there is no reason to use anything else than the HTML5 doctype declaration - it's perfectly backwards compatible, and you should not be using anything that doesn't work with it.
    Again not a thing. HTML doesn't care whether or not you write in caps or lowercase - however, you should always use lowercase to avoid issues, but it doesn't produce errors if you don't.
    While inline styles should be avoided, they will not give you an error message. Inline styles are perfectly valid, and do have their use sometimes.
    HTML doesn't really care. However, this is mostly due to smart handling by the browsers, so to be 100% sure, do encode them. However, unless you're using XHTML, it won't result in a broken page or serious errors.
     
    PoPSiCLe, Jan 10, 2016 IP
  4. Aditya Thakur

    Aditya Thakur Well-Known Member

    Messages:
    30
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #4
    Hi, Anu My suggestion is one should use the schema with a combination of HTML and XHTML that will affect on SEO too. and BTW you told everything about what mistakes we must avoid. Thanks.
     
    Aditya Thakur, Jan 10, 2016 IP
  5. sarahk

    sarahk iTamer Staff

    Messages:
    28,498
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #5
    everything?
     
    sarahk, Jan 10, 2016 IP
    Aditya Thakur likes this.
  6. Aditya Thakur

    Aditya Thakur Well-Known Member

    Messages:
    30
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #6
    Hi Sarahk, Here I mean by "everything" is what all points Anu has discussed above, we should not do these all mistakes while coding :)
     
    Aditya Thakur, Jan 10, 2016 IP
  7. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #7
    You were also talking about using a schema with a combination of HTML and XHTML - how, exactly, are you figuring that out? I'm hoping this is a language barrier of sorts, because that makes NO sense whatsoever.
     
    PoPSiCLe, Jan 11, 2016 IP
    sarahk likes this.
  8. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #8
    Hence my relative silence as I can't figure out what the point was of OP's post with the "broken engrish moist goodry". Here's a tip, if you're going to try and give advice on an English language site, SPEAK ENGLISH... and not Yodish.

    Looking for site you are, found one you have hrrrm?

    I hate being "That Guy", but... What does Marsellus Wallas look like?
     
    deathshadow, Jan 11, 2016 IP
  9. sarahk

    sarahk iTamer Staff

    Messages:
    28,498
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #9
    but some of them aren't even mistakes...
     
    sarahk, Jan 11, 2016 IP