The background banner is failing to display within the divbox

Having some trouble with my top banner in the HTML and CSS code I'm using to create a master page for ASP.NET. Oddly, the banner does show up on the design tab in Visual Studio, but it's not displaying properly. Here's the relevant code, can anyone help out?

HTML:

<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
    <link href="css/StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">        
        <div id="container">
            <div runat="server" id="top">
                        </div>
                </div>
    </form>
</body>
</html>

CSS:

    body 
{
    background-image: url(../Images/background_5.jpg);
    /*font-family: Arial;
    color: rgb(0, 0, 0);
    background-color: rgb(225, 201, 201);
    line-height: normal;
    font-size: 12px;
    background-position: 0% 0%;
    background-repeat: repeat;
    background-attachment: scroll;
    padding: 0px;
    margin-top: 0px;
    margin-left: 0px;
    margin-right: 0px;
    margin-bottom: 0px;*/
}

#form1
{
    width: 1200px;
}

#container
{
    background-color: White;
    padding-left: 20px;
    padding-right: 20px;
    float:left;
    left: 50%;
    position:relative;
    margin-left: -450px;
    width: 910px;
    height: 1800px;
}

#top
{
    background: url(../Images/Banner.jpg);
    /*padding-left: 10px;*/
    height: 250px;
    width: 900px;   
}

#loginDiv
{
    float: right;
    padding-right: 20px;
    text-align: right;
    height: 142px;
    font-family:Century Gothic;
}

#middle
{
    padding-left: 10px;
    width: 900px;
}

Full HTML code available below:

<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
    <link href="css/StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">        
        <div id="container">
            <div runat="server" id="top">

                <asp:Label ID="WelcomeLabel" runat="server" Text="Label" Font-Italic="False" 
                    Font-Names="Century Gothic" Font-Overline="False" Font-Size="Medium"></asp:Label>
                    <br />
                <asp:Button ID="Button1" runat="server" Text="Sign out" BackColor="Black" 
                    BorderColor="Black" BorderStyle="Outset" Font-Names="Century Gothic" 
                    ForeColor="White" Width="75px" />

                <br />

               <div id="loginDiv" runat="server">
                     <asp:Label ID="Label1" runat="server" Text="Username"></asp:Label>
                     &nbsp;&nbsp;&nbsp;
                     <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    <br />
                    <br />
                    <asp:Label ID="Label2" runat="server" Text="Password"></asp:Label>
                    &nbsp;&nbsp;&nbsp;
                    <asp:TextBox ID="TextBox2" runat="server" TextMode="Password"></asp:TextBox>
                     <br />
                     <br />
                    <asp:Button ID="Button2" runat="server" Text="Login" 
                         BackColor="Black" BorderStyle="Outset" Font-Names="Century Gothic" 
                         ForeColor="White"/>
                     <br />
                    <asp:Label ID="Label3" runat="server"></asp:Label>
                    </div>
            </div> 

            <div runat="server" id="middle">
                <div id="left" runat="server" style="float: left; width: 33%; margin: 0; ">
                    Categories
                    <ul>
                        <li>option 1</li>
                        <li>option 2</li>
                        <li>option 3</li>
                        <li>option 4</li>
                    </ul>

                    <div>
                        <asp:Label ID="lblItemsShoppingCart" runat="server" Text=""></asp:Label>
                    </div>
                </div>
                <div id="Right" runat="server" style="float: left; width: 67%; margin: 0; " class="sf_colsOut">                 
                        <asp:contentplaceholder id="contentplace" runat="server" />                 
                </div>
            </div> 
            </div> 

    </form>
</body>
</html>

Answer №1

Have you attempted using the path "~/Images/Banner.jpg"? I have found that sometimes certain paths do not function as intended while others do. It can be a bit unpredictable at times.

Answer №2

URL for the stylesheet:

 <link href="~/css/styles.css" rel="stylesheet" type="text/css" />

Furthermore, for the graphics

Answer №3

Is this how your code is structured?:

background: url(../Images/Banner.jpg);

The ../ part of the path isn't correct; remove it and your code will work perfectly, like this:

(images/banner.jpg);

Additionally, I suggest placing the banner inside a <div>, assigning it an ID, and using position: fixed; top: 0px; to affix it to the top of the page. Make sure to specify width and height for it to appear properly.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Images within links appear with blue lines underneath them

Currently, I am in the process of adding links to a footer by using <img> tags with SVG images. However, I am encountering an issue where there are small blue lines under the icons. After searching online, it seems that you need to add this CSS code: ...

Numerous threads within a web application

Currently, my functional web service is capable of scraping relevant information from various websites upon loading. However, with increasing requirements, the number of httpwebrequests has also grown. At the moment, my web service does not utilize asynch ...

I'm utilizing bootstrap to design a slider, but the length of the second div inside it is longer than the slider div

https://i.sstatic.net/0iIPb.png To ensure that the second div appears above the slide div, I have applied the position:absolute property to the second div. Since the first div is a slide, I had to position the second div outside of the first div. Do you h ...

Duplication of elements in a Meteor and React environment

When it comes to creating a basic Meteor app with React, this is the structure I have put in place: <head> <title>test</title> </head> <body> <div id="render-target"></div> </body> Here is the start ...

How can I redirect a Spotify API request to save data directly to my local filesystem

I am developing a program for personal use that utilizes Spotify's API. My intention is not to make this software public, but rather to access and analyze my own playlist data. However, I am facing an issue with Spotify's authentication process. ...

What could be causing the issue with this jQuery selector for the parent form element?

I created a form that connects a button with an attribute, but it's not hiding the parent("form"). However, when I try this, it works. $($("[editFormContent]").attr("editFormContent")).click(function(e) { e.preventDe ...

Using jQuery to slide elements across the page

I've been attempting to incorporate a sliding effect into my website, but I'm running into an issue where the sliding only occurs on the first click and I can't figure out why. Here is the code snippet I've been using: Html : $("#go ...

Troubleshoot: Problem with iPhone Orientation on Bootstrap Framework

While working on a responsive website design, I encountered an issue that needs addressing. Initially, switching from portrait mode to landscape didn't trigger the expected responsive behavior; instead, it simply zoomed into the site. To prevent this ...

Create a soft focus on the background sans any filters

I am in the process of developing a website and have implemented code to blur out the background: CSS #background{ background: url(img/bg.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o ...

Tips for rearranging a span following an image?

Looking for a solution to rearrange a span element after an image within automatically generated HTML. Sample HTML: <span>closed</span> <img alt="Click to reset" src="xxx" class=""> Currently, the span appears before the img in the cod ...

Are the menubar menus positioned beneath a different div element?

Currently facing an issue with an HTML Menubar where the menus are appearing below another div, and not getting displayed as expected: ...

Extracting unique text values from nested div elements within list items using Selenium with Python

Within the HTML code provided, I am looking to extract the text of three variables (descr_confezione, aic_farmaco, and stato_confezione) for each of the four list items: <ul id="ul_lista_confezioni"> <li style="display: list-item;"> &l ...

How to position collapsible buttons in Twitter's Bootstrap framework

I have successfully created two buttons on the same line. The second button is collapsible and when clicked, it adds a row of two more buttons to the view. However, the newly collapsed row of buttons appears aligned with the second button. I would like th ...

Issues with hover styles and transitions not being correctly applied to newly appended elements in Firefox

Utilizing an SVG as an interactive floor plan, I have implemented a feature where hovering over different areas on the floor plan (<g> elements) causes them to expand and float above other areas. The element scaling is triggered by CSS, but I use jQu ...

Unveiling Fresh URLs within an iFrame

Here is the current situation: www.mywebsite.com/Pagex.html - On this page, there is an iFrame with a default URL (src) from a different domain than the host page (Pagex.html). The code inside the iFrame is a user input form with a submit button. Upon su ...

Is the misalignment due to a floating point error?

Attempted to create a 3-column layout without responsiveness, but encountered an odd alignment issue. http://jsfiddle.net/z5mgqk6s/ #DIV_1 { box-sizing: border-box; color: rgb(255, 255, 255); height: 83.2px; text-align: center; widt ...

Error Encountered in jQuery UI SelectMenu

Struggling to integrate the jQuery UI SelectMenu, I keep encountering the same error in the browser console. Below is the HTML Code: <select name="files" id="files"> <optgroup label="Scripts"> <option value="jquery">jQuery.js</ ...

What is the best way to adjust the responsiveness of my AppDrag page for mobile optimization?

My landing page is all set up, but I'm looking to tweak the font sizes and spacing for mobile users. Can these changes be made using design tools instead of digging into the code? ...

Using jquery to toggle active nav links in Bootstrap

I'm currently working on integrating a jQuery function to automatically update the active status of the navigation links in my Bootstrap Navbar. The structure involves a base HTML file that extends into an app-specific base file, which is further exte ...

Editing HTML on an ASPX website can be a breeze with

Hello there, I've been tasked with editing a website for a client, but the site is located on a local web server and was designed using aspx. As I review all the files, I am encountering difficulty finding the HTML code associated with runat=server w ...