asp.net - How to display a number (generated dynamically) into a square using CSS -


I'm new to CSS. On the me square need to display a number (dynamically generated via the ASP.NET MVC verb method) (normal image, whose face should be replaced with dynamic number).

Can someone help me do this? I'm sure it knows something for just a minute that knows CSS.

Thanks, Victory

The easiest way to do a & lt; Div & gt; will be the one who uses your image as a background-image property so it will be a matter of writing a number in that div:

HTML

  & lt; Div class = "square" & gt; 123 & lt; / Div & gt;  

CSS

  .square {/ * below is the width and height of your background image / / width: 100px; Height: 100 pixels; Background: URL (yourimg.png) no-repeat 0; }  

If you see & lt; Img & gt; tag, then it is a bit tricky, but it is still possible:

HTML

  & lt; Div class = "square" & gt; & Lt; Period & gt; 123 by & lt; / Span & gt; & Lt; Img src = "yourimg.png" / & gt; & Lt; / Div & gt;  

CSS

  .square {/ * below is the width and height of your background image / / width: 100px; Height: 100 pixels; Status: Relative; } .square img {status: relative; Z-index: 1; } .square span {position: absolute; Z-index: 2; / * Use for your number * / top position: 10px; Left: 10px; }  

The actions given below (on the z-index account below) and number to & lt; Img & gt; By creating a pile of elements, it works exactly at the top of it because the position of parent of the number (

) is relative, so it Coordination system is created.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -