A syntax error is a mistake in the code element of the document or page. The error can refer to a missing character or code attribute, a typo in the code, or a superfluous character or code attribute. For example, if the designer opens a hyperlink code with the usual “<a href>” tag attribute, but fails to close it with a corresponding “</a>” tag, Dreamweaver will detect a syntax error on that line of code.
Web browsers use the information in the design code to display the page correctly on the browser screen. If the code contains a syntax error, the browser won’t recognize the code, causing the Web page to display incorrectly. The size of the problem depends on the position of the syntax error, but even a single missing character has the potential to prevent page design elements from displaying correctly.
An error message in Dreamweaver often includes the line number on which the syntax error occurs. Scroll to the referenced line and check the code carefully. In particular, look for missing characters, typos and superfluous characters in the code. If you can’t immediately identify the problem, create the line or section of code from scratch. One option is to switch from “Code” to “Design” view in the main menu. Delete the design object in which the error occurs, then reinsert the item while in Design mode.
Most versions of Adobe Dreamweaver include an HTML validator tool that automatically scans and checks the validity of code in your Web page or document. The tool automatically highlights any syntax errors to allow you to easily find and correct the problem. Dreamweaver CS5 doesn’t include the HTML Validator as a standard feature, but Adobe has released a free plugin that adds the tool to the program. You can also check code for syntax errors through external online services, such as the W3C, Worldwide Web Consortium’s open source Markup Validation Service.
- Photo Credit Comstock/Comstock/Getty Images