Why in the label I don't see the background image of the class "templatemo_product" and see only the values of myDates ?
Thank you
<div class="templatemo_product">
<asp:Label ID="Label1" runat="server">
<img src="/images/templatemo_photo1.jpg" alt="templatemo.com"
width="117" height="76" />
<strong>Vivamus a massa</strong><br />
Donec iaculis felis id neque. Morbi nunc. Praesent varius egestas velit. Donec a
massa ut pede pulvinar vulputate. Nulla et augue. Sed eu nunc quis pede tristique
suscipit. Nam sit amet justo vel libero tincidunt dignissim.
</asp:Label>
<a href="#"><strong>READ MORE </strong></a>
</div>
myDates = Convert.ToString(dr["myDates"]);
Label1.Text = myDates;
You are setting Background for a control like Label which is an inline control. i.e. means it does not have height width unless in css your set as display:block.
So set in css display:block and set height and width and finally make sure the image file url is correct
<div class="templatemo_product">
<asp:Label ID="Label1" runat="server">
<img src="images/templatemo_photo1.jpg" alt="templatemo.com"
width="117" height="76" />
<strong>Vivamus a massa</strong><br />
Donec iaculis felis id neque. Morbi nunc. Praesent varius egestas velit. Donec a
massa ut pede pulvinar vulputate. Nulla et augue. Sed eu nunc quis pede tristique
suscipit. Nam sit amet justo vel libero tincidunt dignissim.
</asp:Label>
<a href="#"><strong>READ MORE </strong></a>
</div>
code-behind:
Label1.Text = Convert.ToString(dr["myDates"]);
TITLE = Convert.ToString(dr["TITLE"]);
cms9651
Member
176 Points
579 Posts
Label and background image in css file
Dec 29, 2012 07:56 PM|LINK
Hi there.
Why in the label I don't see the background image of the class "templatemo_product" and see only the values of myDates ?
Thank you
<div class="templatemo_product"> <asp:Label ID="Label1" runat="server"> <img src="/images/templatemo_photo1.jpg" alt="templatemo.com" width="117" height="76" /> <strong>Vivamus a massa</strong><br /> Donec iaculis felis id neque. Morbi nunc. Praesent varius egestas velit. Donec a massa ut pede pulvinar vulputate. Nulla et augue. Sed eu nunc quis pede tristique suscipit. Nam sit amet justo vel libero tincidunt dignissim. </asp:Label> <a href="#"><strong>READ MORE </strong></a> </div> myDates = Convert.ToString(dr["myDates"]); Label1.Text = myDates;furry
Member
584 Points
108 Posts
Re: Label and background image in css file
Dec 30, 2012 03:58 AM|LINK
the only issue could be the wrong Image path
for e.g; if page in the root dir and image in images folder then path should be like this
<style type="text/css"> .templatemo_product { background-image: url('images/12-10-22.jpg'); } </style>refer this for correct understanding
http://reference.sitepoint.com/css/background-image
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Label and background image in css file
Dec 30, 2012 04:23 AM|LINK
Hi,
I didn't see anything applying with the CSS style.
You should use a pure Html tags and apply the CSS style.
Something like this:
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: Label and background image in css file
Dec 30, 2012 05:20 AM|LINK
You are setting Background for a control like Label which is an inline control. i.e. means it does not have height width unless in css your set as display:block.
So set in css display:block and set height and width and finally make sure the image file url is correct
Contact me
cms9651
Member
176 Points
579 Posts
Re: Label and background image in css file
Dec 30, 2012 09:21 AM|LINK
thank you for help's but don't resolve.
I need in my aspx page replace this layout:
to change new layout with inserting new values of my code behind::
Label1.Text = Convert.ToString(dr["myDates"]); TITLE = Convert.ToString(dr["TITLE"]);But I have this output wrong because the image is canceled and the value of date is left and not supported in the initial image:
css file:
.templatemo_product { float: left; width: 455px; height: 105px; padding: 10px; background: url(images/templatemo_products.jpg) no-repeat; display:block }aspx file:
<div class="templatemo_product"> <asp:Label ID="Label1" runat="server"> <img src="images/templatemo_photo1.jpg" alt="templatemo.com" width="117" height="76" /> <strong>Vivamus a massa</strong><br /> Donec iaculis felis id neque. Morbi nunc. Praesent varius egestas velit. Donec a massa ut pede pulvinar vulputate. Nulla et augue. Sed eu nunc quis pede tristique suscipit. Nam sit amet justo vel libero tincidunt dignissim. </asp:Label> <a href="#"><strong>READ MORE </strong></a> </div>code-behind:
Label1.Text = Convert.ToString(dr["myDates"]); TITLE = Convert.ToString(dr["TITLE"]);Can you help me?