0

I can't figure out how to have the text display on a single line instead of on multiple lines.

This what the user sees

When I list my choices, some fields take up three lines, which makes the list difficult to read.

<td width="205px" height="15px" TextMode="SingleLine">
    @item.Adresse
</td>

I want all of the lines to be a single line in height.

3
  • 1
    have you tried to set style="white-space:nowrap;"? Commented Aug 16, 2021 at 18:25
  • Well that was an easy one. Worked great. Commented Aug 16, 2021 at 18:31
  • As an aside, the TextMode attribute is part of ASP.NET Web Forms, but you tagged this question with ASP.NET Core, and the @item.Adresse is part of the Razor syntax. These are not intercompatible. If you're using ASP.NET Core with Razor templates, you cannot use ASP.NET Web Forms attributes. (Though, even if you were using Web Forms, you'd have still required a runat="Server".) Commented Aug 16, 2021 at 19:13

1 Answer 1

1

There are two ways:

  1. Via the white-space CSS property, e.g.:

    <td style="white-space: nowrap" />
    

    or

  2. nowrap attribute on the td HTML element, e.g.:

    <td nowrap />
    
Sign up to request clarification or add additional context in comments.

1 Comment

I've updated your answer so that your markup is visible. By default, HTML elements are assumed to be for formatting, and not displayed a literal text. You can use markdown, however, to not only display them as code blocks, but also to add syntax highlighting, as I've done. Please review the edits so you know how to make similar updates in the future.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.