Reputation: 2726
In my application, if I have a nicely indented piece of markup like this:
<div>
<label>FOO</label>
<span>BAR</span>
</div>
It renders as FOO BAR
. Whilst this:
<div>
<label>FOO</label><span>BAR</span>
</div>
renders as FOOBAR
I don't want the space, but I do want to keep the indentation in the cshtml file.
Upvotes: 0
Views: 89
Reputation: 119186
This isn't Razor doing it, it's just how HTML rendering works. Look at the raw HTML in your browser:
<div>
<label>FOO</label>
<span>BAR</span>
</div>
<div>
<label>FOO</label><span>BAR</span>
</div>
One way to fix this is to float both the label and span to the left:
div label {
float: left;
}
div span {
float: left;
}
<div>
<label>FOO</label>
<span>BAR</span>
</div>
Upvotes: 2