<cfoutput query="getGames">
<li>
<a href="#li开发者_C百科nk_url#" style="background: #E97B2A; display: block; height: 320px; width: 500px;">#name#</a>
</li>
</cfoutput>
the background color # is breaking it, how can I display the # without closing the cfoutput tag (or using css rgb() )?
The # symbol can be escaped within cfoutput
tags and in other areas such as strings by doubling it up like ##.
So you need to use the following code:
<cfoutput query="getGames">
<li>
<a href="#link_url#" style="background: ##E97B2A; display: block; height: 320px; width: 500px;">#name#</a>
</li>
</cfoutput>
Loftx's answer will work perfectly. But another option is to move the CSS styling to a .css file or to a style area of your page that sits outside of your cfoutput tags.
<!--- outside the cfoutput you can use single # characters --->
<style type="text/css">
.mystyle { background: #E97B2A; display: block; height: 320px; width: 500px; }
</style>
<!--- inside the cfoutput, # characters must be paired up. --->
<cfoutput query="getGames">
<li>
<a href="#link_url#" class="mystyle">#name#</a>
</li>
</cfoutput>
精彩评论