• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

ASP.net HTML5 position image in centre of div

Hi. I am trying to position the image in the following div in my ASP.net project but it appears on the left

 <div style="float: left; width: 25%;" class="div" >
        <h1 style="font-family:'Century Gothic';font-size:16px">xxxxxxxxxxxxxxxxxxxxxx</h1>
     <h2 style="font-family:'Century Gothic';font-size:14px">xxxxxxxxxxxxxxxxxxxxxxxxxx</h2>    
     <p style="font-family:'Century Gothic';font-size:12px">
      Connecting all the users in your operation to a cloud SQL central database will bolster your data management, accelerate your processes and sharpen your decision making.</p>
        <p style="font-family:'Century Gothic';font-size:12px">
            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
        </p>
<asp:Image ID="Image1" runat="server" Height="144px" ImageUrl="~/Resources/Cloud_Hub.jpg" Width="287px"  ImageAlign="Middle" />
        <p style="font-family:'Century Gothic';font-size:12px">
            &nbsp;</p>
 </div>
0
Murray Brown
Asked:
Murray Brown
2 Solutions
 
MrunalCommented:
Because you have written - "float: left;" for your outer div.
Remove that.

Add this image inside of DIV and you can add css for that DIV only.
0
 
Jim RiddlesPrepress/OMS SpecialistCommented:
It would help to see your generated code, not the native code.  If you have a link to the generated page, that would be best.

Also, please use the Code tag anytime you need to display code.  It is very helpful for the experts trying to assist you.

One key item is that you are using an attribute incorrectly, I believe.  When attempting to align an image, the correct attribute is "align", not "ImageAlign".  That attribute has also been depreciated, and does not work for HTML5 pages.  Not seeing your full page, I can't tell what doctype you are declaring.

If you are declaring a HTML5 doctype, then you need to use CSS to achieve the same effect.  The code is something like this:

<asp:Image ID="Image1" runat="server" Height="144px" ImageUrl="~/Resources/Cloud_Hub.jpg" Width="287px"  style="vertical-align:middle;" />

Open in new window


Let me know if you require further assistance.
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now