Converting HTML to Visualforce

When converting HTML files to Visualforce there is a few things you have to remember. Every tag needs to be closed. Some tags in HTML have more than one acceptable way of writing them. For instance take a look at the <br> tag. This tag creates a line break but you can also write it like this: <br/>. In Visualforce it only accepts one version of the BR tag and its <br/>. Visualforce heavily depends on tags being closed correcty so it doesn’t disrupt the visualforce markup further on in the same page.

Some popular tags that do not have a end tag to match it need to be closed in the same line. An example of this is very similar to the <br/> tag explained.

Examples:
<img scr=””/>
<meta name=”robotscontent=”noindex,follow“/>
<link rel=’stylesheetid=’style-csshref=” type=’text/cssmedia=’all‘ />

Following the rule of using /> for every single tag that does not have a specific end tag like </script> or </body> you should have little issue copy pasting html into a new visualforce page.

Add Comment