Whenver I use @{ } or @( ) in the webpage and run it from Visual Studio, then in the web-browser, i noticed in the view source are are line break before the @{ syntax and another line break after the } syntax.
Is there a way to prevent line break so the view source become easier to read?
Thanks...
Use white-space: nowrap; or give that link more space by setting li 's width to greater values. I prevented line break in li items using display: inline; . Maybe this will also help others with similar problems. Its important to be careful with display: inline as it can have side effects.
<nobr> The NOBR element prevents line breaks.
The white-space property has numerous options, all of which define how to treat white space inside a given element. Here, you have set white-space to nowrap , which will prevent all line breaks.
I don't think there is anything you can do regarding the line breaks. The formatting is as per source file after its been compiled and rendered from the server side.
The effect to the end user in terms of layout is nothing as its not a html line break: <br>
You can put server side code in-line as per the example below which will stop the line spacing:
a<br/>@{ /*some code 1 that does not produce a line break*/}
b<br />
c<br />
@{
/*some code 2 that does produce line breaks*/
}
d<br />
e<br />
this will produce the following:
a<br />
b<br />
c<br />
d<br />
e<br />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With