1

I have this code:

<div class="testexample" style="top:@example.Y px"></div>

I thought this would work fine, but the browser is complaining about the spaces in the style.

(Invalid property value)

Any ideas to solve this?

Max
  • 23
  • 8

2 Answers2

3

You can put the whole string inside an expression syntax like this:

<div class="testexample" style="top:@(example.Y + "px")"></div>
Ghasan غسان
  • 5,577
  • 4
  • 33
  • 44
0

instead of this you can use it in calc

<div class="testexample" style="top:calc( @example.Y )px"></div>

or

<div class="testexample" style="top:(@example.Y)px"></div>
Super User
  • 9,448
  • 3
  • 31
  • 47