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

  • Home
  • SEARCH
  • 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 523765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:29:47+00:00 2026-05-13T08:29:47+00:00

A carriage return in my html code causes a visual space in the rendered

  • 0

A carriage return in my html code causes a visual space in the rendered html in Explorer 8. I’m guessing this will affect other versions too.

For example:

<span>
(111)&nbsp;
222-
3333&nbsp;
444444
</span>

looks like this:

(111)  222- 3333  444444

There should be only 1 space after the first bracket, no space after the dash and only 1 space after the last 3. I like the carriage returns for code readability, is it possible go keep then and still get the html to render properly in IE?

Here’s the doctype information:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

Edit:
I’m actually doing this in an ASP.NET MVC 2 app, and the aspx template markup is quite verbose which is why I’ve tried to seperate it into multiple lines:

<span>
(<%=((Model == null || Model.AreaCode == null) ? "" : Model.AreaCode).PadRight(3)%>)&nbsp;
<%=((Model == null || Model.Prefix == null) ? "" : Model.Prefix).PadRight(3)%>-
<%=((Model == null || Model.Suffix == null) ? "" : Model.Suffix).PadRight(4)%>&nbsp;
<%=(Model == null || Model.Extension == null) ? "" : Model.Extension%>
</span>
  • 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-13T08:29:47+00:00Added an answer on May 13, 2026 at 8:29 am

    This is a scenario where sprintf type functions really shine. In the .NET world these are handled by String.Format. Here’s the MSDN documentation and you could rewrite the code something like this:

    <span>
    <%= String.Format("({0:###}) {1:###}-{2:####} {3}", Model.AreaCode, Model.Prefix, Model.Suffix, Model.Extension); %>
    </span>
    

    I’m a little rusty on the .NET string format syntax, so no guarantees on that code snippet. Here’s another link:

    http://blog.stevex.net/string-formatting-in-csharp/

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

Sidebar

Ask A Question

Stats

  • Questions 269k
  • Answers 269k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It's a breeze with jQuery (which your referenced site is… May 13, 2026 at 1:19 pm
  • Editorial Team
    Editorial Team added an answer In recent versions of the iPhone SDK (3.0 and later,)… May 13, 2026 at 1:19 pm
  • Editorial Team
    Editorial Team added an answer It's trying to load the common images from the symfony… May 13, 2026 at 1:19 pm

Related Questions

I need someone to explain to me where this extra padding is coming from
I'm trying to work my way through Ron Jeffries's Extreme Programming Adventures in C#.
I have an HTML page that uses the JSONP Plugin to gracefully handle errors
This might be a stupid question but if there's a better or proper way
Consider the following code in VB9: Dim text = Line1<br/>Line2 Dim markup = <span><%=

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.