user8280126
user8280126

Reputation:

MVC Bootstrap CSS Layout Left Alignment

Which Bootstrap field here https://getbootstrap.com/docs/3.3/customize/ will help me control left alignment?

Trying to customize a default startup MVC application homepage.

enter image description here

Upvotes: 0

Views: 2098

Answers (3)

ASP.Net MVC has folders Views\Shared\_Layout.cshtml

For example:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title – приложение ASP.NET</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
</head>
<body>
    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                @Html.ActionLink("WebApp", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li>@Html.ActionLink("Home", "Index", "Home")</li>
                    <li>@Html.ActionLink("Calculator", "Calculator", "Home")</li>
                </ul>
            </div>
        </div>
    </div>
    <div class="container body-content">
        @RenderBody()
        <hr />
        <footer>
            <p>&copy; @DateTime.Now.Year – application ASP.NET</p>
        </footer>
    </div>

    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("scripts", required: false)
</body>
</html>

It is template for site.

You can add css property for example .yourcontainer:

<div class="container body-content yourcontaine">
    @RenderBody()
    <hr />
    <footer>
        <p>&copy; @DateTime.Now.Year – application ASP.NET</p>
    </footer>
</div>

And write the necessary properties:

.yourcontaine{
    /*your properties*/
}

Or change HTML to:

<div class="container">
    <div class="col-md-offset-2 col-md-8">
        @RenderBody()
    </div>
    <hr />
    <footer>
        <p>&copy; @DateTime.Now.Year – application ASP.NET</p>
    </footer>
</div>

Upvotes: 0

Vicky_Burnwal
Vicky_Burnwal

Reputation: 981

You need pull-left. Apply this class to master div container.

Attaching screenshot.

enter image description here

Upvotes: 0

jdickel
jdickel

Reputation: 1457

Since you did not post any code i will take a guess.

Have you used <div class="container">?
If yes, try to replace it with <div class="container-fluid">. This will make your content fit to the whole side instead of resizing it to a vertical bar in the middle.

You should also read up on fluid-containers in bootstrap


EDIT: If you really just want to adjust the container size you need to change those values at bootstrap container-sized which is the size of the 'vertical content bar'-width

Upvotes: 2

Related Questions