Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6615315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:26:49+00:00 2026-05-25T20:26:49+00:00

In HTML, I was always taught to close self-closing with a />. For example

  • 0

In HTML, I was always taught to close self-closing with a “/>”. For example “<br />“, “<input type='button' value='myButton' />“, etc.

In Coldfusion, though, it seems to be standard to just never close these tags. I’m constantly seeing code like:

<cfset myVariable = someValue>
<cfset myOtherVariable = someOtherValue>

etc.

Is this bad code, or is it commonly accepted? I’ve seen it almost anywhere that I’ve seen coldfusion code. Is there any benefit to closing these tags, or is it fine to leave it as it is?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:26:49+00:00Added an answer on May 25, 2026 at 8:26 pm

    Because there’s no official coding standard for CFML, it’s up to you whether to use these. Same as using uppercase/lowercase tags.

    Personally I love to have my code beautiful and readable, so I’m always using this syntax for single tags.

    But there is at least one techincal difference: custom tags. Let me show this by example.

    Consider following custom tag:

    <cfif thisTag.ExecutionMode EQ "start">
        started<br/>
    </cfif>
    
    running<br/>
    
    <cfif thisTag.ExecutionMode EQ "end">
        ended<br/>
    </cfif>
    

    Now these two types of invokation:

    <p>&lt;cf_demo&gt;</p>
    
    <cf_demo>
    
    <p>&lt;cf_demo /&gt;</p>
    
    <cf_demo />
    

    And here’s the output:

    <cf_demo>
    started
    running
    
    <cf_demo />
    started
    running
    running
    ended
    

    Second syntax is equivalent of <cf_demo></cf_demo>.

    Possibly there are more differences, but I can’t remember any at this moment… 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The value is always undefined (Chrome 12.0.742.112). The .get() does return an HTML input
Why is the MAX_FILE_SIZE for an HTML <input type=file> always in uppercase? All examples
HTML Javascript question to get the selected value of a input-select I can use
Tomcat always returns http header Content-Type as text/html;charset=ISO-8859-1 , if I set it in
I would like to make an HTML text input field that always shows its
I'm always feel the disabled attribute for HTML <input> and all is twisting my
Whenever I use Html.ActionLink it always Html encodes my display string. For instance I
I've always used single quotes when writing my HTML by hand. I work with
I'm trying to get title of simple html document to build sitemap. But always
---HTML <div id=story> <div id=individual> <img src='uploads/1231924837Picture.png'/> <h2>2009-01-14</h2> <h1>Headline</h1> <p>stroy story etc stroy story

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.