Pregunta

I'm using the below template from bootstrap - https://startbootstrap.com/template-overviews/grayscale/ for my web app. We are using an ASP.net web form architecture to build this web app. When I load all the files to my web app and run the app without any changes to the code the background image is dis oriented in the aspx file. enter image description here

But strangely when i run using the html file the background image orients properly. enter image description here

I checked all the references and both are identical. I believe something is happening in css class below when run as html vs aspx pages , but not sure what is going wrong.

.intro

{
    display: table;
    width: 100%;

    height: auto;

    padding: 100px 0;
    text-align: center;
    color: #fff;
    /*background: url(../img/intro-bg.jpg) no-repeat bottom center scroll;*/

    background-color: #000;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

.intro-body {
    display: table-cell;
    vertical-align: middle;

    /*height: 991px;*/

}

Please advise !

as requested by one of the user, here is my aspx code - its the same from the source

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="Project9xz.Index" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Project 9xz</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="" />
    <meta name="author" content="" />


    <link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />

    <!-- Fonts -->
    <link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href='http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css' />
    <link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css' />

    <!-- Custom Theme CSS -->
    <link href="css/grayscale.css" rel="stylesheet" />

</head>
<body id="page-top" data-spy="scroll" data-target=".navbar-custom">
    <form id="form1" runat="server">
        <div>
            <nav class="navbar navbar-custom navbar-fixed-top" role="navigation">
                <div class="container">
                    <div class="navbar-header page-scroll">
                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse">
                            <i class="fa fa-bars"></i>
                        </button>
                        <a class="navbar-brand" href="#page-top">
                            <i class="fa fa-play-circle"></i><span class="light">Start</span> Bootstrap
                        </a>
                    </div>

                    <!-- Collect the nav links, forms, and other content for toggling -->
                    <div class="collapse navbar-collapse navbar-right navbar-main-collapse">
                        <ul class="nav navbar-nav">
                            <!-- Hidden li included to remove active class from about link when scrolled up past about section -->
                            <li class="hidden">
                                <a href="#page-top"></a>
                            </li>
                            <li class="page-scroll">
                                <a href="#about">About</a>
                            </li>
                            <li class="page-scroll">
                                <a href="#download">Download</a>
                            </li>
                            <li class="page-scroll">
                                <a href="#contact">Contact</a>
                            </li>
                        </ul>
                    </div>
                    <!-- /.navbar-collapse -->
                </div>
                <!-- /.container -->
            </nav>

            <section class="intro">
                <div class="intro-body">
                    <div class="container">
                        <div class="row">
                            <div class="col-md-8 col-md-offset-2">
                                <h1 class="brand-heading">Grayscale</h1>
                                <p class="intro-text">A free, premium quality, responsive one page Bootstrap theme created by Start Bootstrap.</p>
                                <div class="page-scroll">
                                    <a href="#about" class="btn btn-circle">
                                        <i class="fa fa-angle-double-down animated"></i>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>

            <section id="about" class="container content-section text-center">
                <div class="row">
                    <div class="col-lg-8 col-lg-offset-2">
                        <h2>About Grayscale</h2>
                        <p>Grayscale is a premium quality, free Bootstrap 3 theme created by Start Bootstrap. It can be yours right now, all you need to do is download the template on the preview page. You can use this template for any purpose, personal or commercial.</p>
                        <p>This striking, black and white theme features stock photographs by <a href="http://gratisography.com/">Gratisography</a> along with a custom Google Map skin courtesy of <a href="http://snazzymaps.com/">Snazzy Maps</a>.</p>
                        <p>With this template, just the slightest splash of color can make a huge impact on the overall presentation and design.</p>
                    </div>
                </div>
            </section>

            <section id="download" class="content-section text-center">
                <div class="download-section">
                    <div class="container">
                        <div class="col-lg-8 col-lg-offset-2">
                            <h2>Download Grayscale</h2>
                            <p>You can download Grayscale for free on the download page at Start Bootstrap. You can also get the source code directly from GitHub if you prefer. Additionally, Grayscale is the first Start Bootstrap theme to come with a LESS file for easy color customization!</p>
                            <a href="http://startbootstrap.com/grayscale" class="btn btn-default btn-lg">Visit Download Page</a>
                        </div>
                    </div>
                </div>
            </section>

            <section id="contact" class="container content-section text-center">
                <div class="row">
                    <div class="col-lg-8 col-lg-offset-2">
                        <h2>Contact Start Bootstrap</h2>
                        <p>Feel free to email us to provide some feedback on our templates, give us suggestions for new templates and themes, or to just say hello!</p>
                        <p>feedback@startbootstrap.com</p>
                        <ul class="list-inline banner-social-buttons">
                            <li><a href="https://twitter.com/SBootstrap" class="btn btn-default btn-lg"><i class="fa fa-twitter fa-fw"></i><span class="network-name">Twitter</span></a>
                            </li>
                            <li><a href="https://github.com/IronSummitMedia/startbootstrap" class="btn btn-default btn-lg"><i class="fa fa-github fa-fw"></i><span class="network-name">Github</span></a>
                            </li>
                            <li><a href="https://plus.google.com/+Startbootstrap/posts" class="btn btn-default btn-lg"><i class="fa fa-google-plus fa-fw"></i><span class="network-name">Google+</span></a>
                            </li>
                        </ul>
                    </div>
                </div>
            </section>

            <div id="map"></div>

            <!-- Core JavaScript Files -->
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
            <script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
            <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>

            <!-- Google Maps API Key - You will need to use your own API key to use the map feature -->
            <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCRngKslUGJTlibkQ3FkfTxj3Xss1UlZDA&sensor=false"></script>

            <!-- Custom Theme JavaScript -->
            <script src="js/grayscale.js"></script>
        </div>
    </form>
</body>
</html>
¿Fue útil?

Solución

After through research and a help from asp.net forum, found the error. i need to add height 100% to the form and div elements. I know inline css is not good practice, but here is the quick snippet which worked .

 <form id="form1" style="height:100%;" runat="server">
        <div style="height:100%;">
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top