Center Text with Image in MVC

I am trying to center the actionlink with the image but I am not being able to, could you try to see where did I fail. In the code I display the the Images that are in the database

model List<Clothes>
@using FinalProject.Models;

@{
    ViewBag.Title = "Home Page";
}

<br /><br /><br />

@if (Model != null)
{

        foreach (Clothes Id in Model)
        {

            if (Id.Amount > 0)
            {
                <div class="col-sm-3">

                    <img src="~/Content/img/@Html.DisplayFor(model => Id.ImagePath)" style="height:200px;width:200px;" />
                    <br />
                    <p class="navbar-text">@Html.ActionLink("Add To Cart", "Order", "RealCart", new { idOrder = Id.Id }, null)</p>
                    <br />
                    <br />
                </div>            
            }

        }

}

1 answer

  • answered 2017-06-17 18:49 Roxy'Pro

    As much as I can see here, you defined:

    <div class="col-sm-3">
    

    And if you want to display image in a center of a screen add col-sm-12 istead od col-sm-3 but before you try that, you might try adding a text-center class to .col-sm-x and some of this might help you. Please apply it and leave a reply here does it helped you.