Click here to Skip to main content
15,888,218 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I want to Put a picture at top of page which occupied all with of screen.
HTML
<div class="navbar-header pull-left">
                    <a class="navbar-brand" href="@Url.Action("Index", "Home")">
                        <img src="../Images/img1.png" alt="Site Logo" style="height:auto; width:100%" />
                    </a>
                </div>


I use of width:100%.
But the picture is shown as it’s really size.
And Is it right the situation of commands in the file?
The code of file is Bellow :

thanks

HTML
<pre><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - </title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    <script src="~/Scripts/jquery-3.4.1.js"></script>
    <script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
    <script src="-/Scripts/jquery.unobtrusive-ajax.min.js"></script>
    

</head>
<body>
    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">

<div class="navbar-header pull-left">
                    <a class="navbar-brand" href="@Url.Action("Index", "Home")">
                        <img src="../Images/img1.png" alt="Site Logo" style="height:auto; width:100%" />
                    </a>
                </div>

                <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>
                            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li>@Html.ActionLink("Home", "Index", "Home")</li>
                    
                </ul>

            </div>
        </div>
    </div>

    
    <div class="container body-content">
        @RenderBody()
        <hr />
        <footer>
            <p>© @DateTime.Now.Year - <span style="color:aqua"><a href="http://www.Besat.ir" target="_blank">my company information</a></span></p>
        </footer>
    </div>



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


What I have tried:

i don't know what should i do
.......................
help please.
Posted
Updated 27-Mar-20 0:07am

1 solution

I assume you're using Bootstrap 3? pull-left doesn't exist in Bootstrap 4.

The pull-left class applies float:left to the element. This takes it out of the normal document flow, so 100% width doesn't have any sensible meaning.

You might be able to resolve this by using viewport units: width:100vw;
<length> - CSS: Cascading Style Sheets | MDN[^]
Fun with Viewport Units | CSS-Tricks[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900