answersLogoWhite

0

What is code semantics?

Updated: 12/11/2022
User Avatar

Wiki User

12y ago

Best Answer

Even if you are not a web designer, you are probably aware that your site has been written in HTML. HTML was originally intended as a means of describing the content of a document, not as a means to make it appear visually pleasing. Semantic code returns to this original concept and encourages web designers to write code that describes the content rather than how that content should look. For example, the title of a page could be coded like this:

This is the page title

This would make the title large and bold giving it the appearance of a page title, but there is nothing that describes it as a title in the code. This means a computer is unable to identify this as being the page title.

To write the same title semantically so that a computer understands that this is a title, you would use the following code:

This is a heading

The appearance of your heading can then be defined in a separate file called a "cascading style sheet" without interfering with your descriptive (semantic) HTML code.

Why Is Semantic Code Important?I have already hinted at one reason why semantic code is important when I said that without explaining what a piece of content is, a computer has no way of identifying it. The ability for a computer to be able to understand your content is important for a number of reasons:
  • Many visually impaired people rely on speech browsers to read pages back to them. These programs cannot interpret pages very well unless they are clearly explained. In other words semantic code aids accessibility
  • Search engines need to understand what your content is about in order to rank you properly on search engines. Semantic code tends to improve your placement on search engines, as it is easier for the "search engine Spiders" to understand.

However, semantic code has other benefits too:

  • As you can see from the example above, semantic code is shorter and so downloads faster.
  • Semantic code makes site updates easier because you can apply design style to headings across an entire site instead of on a per page basis.
  • Semantic code is easier for people to understand too so if a new web designer picks up the code they can learn it much faster.
  • Because semantic code does not contain design elements it is possible to change the look and feel of your site without recoding all of the HTML.
  • Once again, because design is held separately from your content, semantic code allows anybody to add or edit pages without having to have a good eye for design. You simply describe the content and the cascading style sheet defines what that content looks like.
How To Ensure A Site Uses Semantic Code?There is no tool that can check for semantic code. It is a matter of looking at the code and seeing if it refers to colours, fonts or layout instead of describing what the content is. If looking at code all sounds a bit too scary then a good place to start is by asking your web designer if he codes semantically. If he looks at you blankly or starts waffling, you can be sure he does not. At that point you need to decide if you wish to pressure him into getting up tospeed or if you want to find yourself a new designer!
User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

The meaning of a legal (syntax correctness) expression.

Examine the expression of 'A' + 1:

Some programming languages will yield 'B' (the character B)

Some will yield "A1" (the string A1)

Some will yield the integer value of 66 (the ASCII value of 'A' = 65)

Some programming languages will not even compile (syntax errors), and hence no semantic meaning

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is code semantics?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are semantics in PHP?

In PHP, semantics refer to the meaning of code or how statements are interpreted by the PHP engine. It involves understanding how code functions and interacts with other elements in a PHP script. Proper semantics ensure that the code behaves as expected and follows the established rules of the PHP language.


What has the author Stephen Ullmann written?

Stephen Ullmann has written: 'Semantics' -- subject(s): Semantics 'The principles of semantics' -- subject(s): Semantics


When did The Semantics end?

The Semantics ended in 1996.


When was Journal of Semantics created?

Journal of Semantics was created in 1982.


What is a sentence for semantics?

Some people dont know the sentence for semantics.


When was Journal of Web Semantics created?

Journal of Web Semantics was created in 2003.


When was Natural Language Semantics created?

Natural Language Semantics was created in 1993.


What is distinction between semantics and syntax?

semantics = words; syntax = how they're used


Semantics in a sentence?

Semantics refer to the meaning of words and how they are interpreted within a particular context or language.


Why do compiler writers need formal grammars?

Just as a person requires knowledge of the syntax (structure) and semantics (meaning) of a spoken language, so too does the compiler need to "understand" how to interpret what is being given to it. A formal grammar provides the rules of syntax and semantics.


What are the major differences between pragmatics and semantics?

Semantics is how we say something. Pragmatics is how we do something.


What has the author Emma Borg written?

Emma Borg has written: 'Minimal Semantics' -- subject(s): Semantics