Color overlay on top of image background

I'm struggling to create a striped colored background with a narrow center single color background on top for showcasing articles and photos. However, I am unable to get the colored background to display correctly. Despite trying different approaches like using divs and multiple backgrounds in the body CSS, I can't seem to identify what is causing the issue. Where should I insert the code?

Additionally, I'm facing challenges while working on a coded gallery.

The CSS file:

body {
        text-align: center;
        background: url("redstripebackground.jpg");
        background-repeat:no-repeat;
        background-attachment:fixed;
        background-size: cover;
        background-position: center top;
    }

#nav {
     font-family: Celtic Garamond the 2nd;
     font-weight: bold;
     font-size: 14pt;
     width:1000px;
     margin:0 auto;
 }

#nav ul {
list-style-type: none;
margin: 0;
padding: 0;
}

#nav ul li {
    float: left;
}

    #nav ul li a {
        display: block;
        padding: 5px 25px 2px 25px;
        color: #000000;
        background-color: #FF0000;
        text-decoration: none;
        height: 24px;
        text-transform:uppercase;
        width:150px;
        z-index: 11;
    }

        #nav ul li a.active {
             background-color: #FFBF00;
        }

            #nav ul li a.active:hover {
                 background-color: #FFBF00;
            }

        #nav ul li a:hover {
            background-color: #FFBF00;
            color: #000000;
        }
#icon {
     font-family: Varsity Regular;
     font-weight: bold;
     font-size: 50pt;
     width:1000px;
     margin:0 auto;
 }

#icon ul {
list-style-type: none;
margin: 0;
padding: 0;
}

#icon ul li {
    float: left;
}

    #icon ul li a {
        display: block;
        padding: 0px 25px 10px 25px;
        margin: 0px 0px 0px 0px;
        color: #000000;
        background-color: #FF0000;
        text-decoration: none;
        height: 60px;
        text-transform:uppercase;
        width:150px;
        border-radius: 0px 0px 20px 20px;
        z-index: 11;
    }
    #icon ul li a.active {
         background-color: #FFBF00;
    }

    #icon ul li a.active:hover {
         background-color: #FFBF00;
    }

    #icon ul li a:hover {
        background-color: #FFBF00;
        color: #000000;
    }

Navigation bar file:

<!DOCTYPE html>
<html lang="en">
    <head>
        <link rel="stylesheet" type="text/css" href="mystyle.css">
        <link rel="stylesheet" type="text/css" href="headerandBackground.css">
    </head>
<body>
  <div id="nav">
    <ul>
           <li><a href="#">Club</a></li>
           <li><a href="#">News</a></li>
    </ul>
  </div>
  <div id="icon">
    <ul>
           <li><a href="#">UCLC</a></li>
    </ul>
  </div>
  <div id="nav">
    <ul>
           <li><a href="#">Media</a></li>
           <li><a href="#">Contact</a></li>
    </ul>
</div>
</body>
</html>

Home Page:

<!DOCTYPE html>
<html>
<head>
    <link href="/normalize.css" rel="stylesheet">
</script>
     <style>
     body{
         width:1000px;
         margin:0 auto;
    }
    #cp_widget_63af049c-b69e-4e75-8019-da486b92eef5{
    width:900px;
    position: relative;
    margin:0px auto;
    z-index: -1;
}
</style>
</head>
<body>
<?php include('Navbar.php'); ?>

    <div id="cp_widget_63af049c-b69e-4e75-8019-da486b92eef5">...</div><scripttype="text/javascript">
var cpo = []; cpo["_object"] ="cp_widget_63af049c-b69e-4e75-8019-da486b92eef5"; cpo["_fid"] = "AgNAf3ry4BXk";
var _cpmp = _cpmp || []; _cpmp.push(cpo);
(function() { var cp = document.createElement("script"); cp.type = "text/javascript";
cp.async = true; cp.src = "//www.cincopa.com/media-platform/runtime/libasync.js";
var c = document.getElementsByTagName("script")[0];
c.parentNode.insertBefore(cp, c); })(); </script><noscript>Powered by Cincopa <a href='http://www.cincopa.com/video-hosting'>Video Streaming Hosting</a> solution.<span>New Gallery 2014/7/25</span><span>height</span><span> 500</span><span>width</span><span> 958</span><span>camerasoftware</span><span> Paint.NET v3.5.11</span><span>originaldate</span><span> 1/1/0001 6:00:00 AM</span><span>height</span><span> 620</span><span>width</span><span> 1024</span><span>camerasoftware</span><span> Paint.NET v3.5.11</span><span>originaldate</span><span> 1/1/0001 6:00:00 AM</span><span>height</span><span> 500</span><span>width</span><span> 960</span><span>camerasoftware</span><span> Paint.NET v3.5.11</span><span>originaldate</span><span> 1/1/0001 6:00:00 AM</span><span>height</span><span> 500</span><span>width</span><span> 957</span><span>camerasoftware</span><span> Paint.NET v3.5.11</span><span>originaldate</span><span> 1/1/0001 6:00:00 AM</span></noscript>

    </body>
    </html>

Answer №1

Based on your description, it sounds like you just need a simple webpage with a background image and a centered area with color.

Here is the HTML code:

   <!DOCTYPE html>
    <html>
    <head>
        <link href="/style.css" rel="stylesheet">
    </head>
    <body>
      <div id="content">
        <p>My content, articles images and stuff</p>
      </div>
    </body>
  </html>

And here is the CSS code:

body{
  background: red url("redstripebackground.jpg") center top no-repeat fixed; /* style based on your stylesheet */
  background-size: cover;
}
#content{
  background: #fff; /* replace with your desired color */
  margin: 20px auto; /* horizontally center div with 20px spacing from top and bottom */
  padding: 10px 15px; /* spacing between content and white colored area */
  width: 80%; /* width of the colored area */
}

You can view the working example here.

If you have a different issue with a coded gallery, please provide more information for further assistance. (Note: If using navigation php, you may not need to include head or body tags).

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

Incorporate the {{ }} syntax to implement the Function

Can a function, such as toLocaleLowerCase(), be used inside {{ }}? If not, is there an alternative method for achieving this? <div *ngFor="let item of elements| keyvalue :originalOrder" class="row mt-3"> <label class=" ...

What is the best way to access attributes from a div element?

I am currently working on extracting attributes from within a div tag, specifically the custom attributes of the first child element. I am using web scraping techniques with Node.js and Puppeteer. My goal is to retrieve the custom attributes data-ticker, d ...

``Considering the compatibility issues with position: absolute in Internet Explorer 8

Here's an example snippet of code in HTML: <form> <input type="file" id="iefile"> </form> <form> <input type="file" id="iefile"> </form> This is how it looks with some CSS styling: form{ position:rela ...

Adjusting the size of the post title's font

Looking to decrease the font size of the latest post's title and keep it centered on my Jekyll based blog. I attempted to adjust https://github.com/x0v/x0v.github.io/blob/master/_sass/atoms/_feature-title.scss by adding font-size: 45px !important; f ...

The Eclipse Phonegap framework is experiencing difficulty in loading an external string file with the jquery .load function

A basic index.html file has been created to showcase a text string from the test.txt file by utilizing the .load function from the jQuery library. The goal is to insert the textual content into an HTML (div class="konten"). The provided HTML script looks ...

Developing an IF statement in JavaScript that relies on hexadecimal color values

I've created a JavaScript code that changes the background color of my webpage every time it loads: document.getElementById("band").style.background = '#'+(Math.random()*0xFFFFFF<<0).toString(16); To improve visibility, I am aiming t ...

How can I troubleshoot an image not appearing in Bootstrap within a Laravel Blade file while using PHPStorm?

Forgive me if this sounds like a silly question: I attempted to use the following src attribute in an img tag to show an image on a website created with Bootstrap, while using phpstorm with a laravel blade file: src="C:\Users\MAHE\Pictures&b ...

Utilize a jQuery selector to target the initial element of every alphabet character

I'm seeking some assistance with jQuery selectors and have a specific scenario that I need help with. Here is the HTML structure I am working with: <ul> <li class="ln-a"></li> <li class="ln-b"></li> <li cl ...

The text is not rendering properly, with some characters being replaced by different ones

RESOLUTION: To fix the issue, eliminate font-family, font-size, and color properties from the parent div. UPDATE: The problem only occurs when I press CTRL + F5. UPDATE 2: After investigating, I found that the culprit is .site-footer with a position:abso ...

adjust highcharts chart size to fit screen width

Has anyone experienced issues with setting an explicit width of 400px on a chart? I am facing difficulties as the chart gets cut off instead of scaling down to that size. My main concern is having it resized properly for an iPhone mobile site. Can anyone ...

Learn how to center content and stretch a column using Vuetify frameworks

Looking for a layout with 2 columns of equal height and centered content vertically? Here's how to achieve it using Vuetify! Check out the code snippet below: <div id="app"> <v-app> <v-row align="center"> ...

Locate the coordinates on an HTML5 canvas that correspond to a specified color

Is there a more efficient method to identify the coordinates of pixels with a particular color without looping through every pixel in the image? ...

Track user sessions and transfer username to final page

Is there a way to showcase the chosen username from a dropdown menu on the initial page and then also display it on the last page without having to pass variables between pages? Additionally, if I wish to incorporate a timer on a middle page, how can I sto ...

The fillOpacity and opacity properties appear to be malfunctioning

Note: While I understand that image masking can solve my issue, I prefer not to use it as it would require me to use my image as a background and could present accessibility challenges. I am specifically looking for solutions involving clip-path. Issue: T ...

Centering the logo using Material-UI's alignment feature

Need help centering a logo in my login form using Material-UI. Everything else is centered except for the logo, which is stuck to the left side of the card. I've tried adding align="center" and justify="center" under the img tag, but it's still ...

Change the appearance of a div based on the presence of a certain class within a child div using jQuery styling techniques

I'm trying to set a default padding of 15px for div.content, but if it contains a child div.products-list, I want the padding to be removed. I've looked into solutions using jquery, but nothing seems to work. Here's how my layout is structur ...

The alignment of image and text next to each other is not functioning as intended

I've been attempting to display an image and text next to each other, but I'm encountering some issues. The current output looks like the figure below: https://i.stack.imgur.com/WxxrS.jpg The desired layout is as shown in the following link: ht ...

Tips for updating the current image in the control navigation of the flexslider

I want to customize the control nav image to give it a unique appearance that corresponds to the slide image. Here's my JavaScript code: $(window).load(function() { $('#main-slider').flexslider({ animation: "fade", controlNa ...

My website includes a <div> section that features both an image and a <figcaption>. However, when I attempt to apply padding to the <figcaption>, it does not seem to take effect

I've been trying to troubleshoot this code, but the padding just won't cooperate and I can't seem to figure out why. .img-caption { visibility:hidden; width:22%; height:435px; background-color:#f9f4e3; ...

Calculate the number of items per month by utilizing JSON and the jQuery `each()` function paired with an IF statement

Looking to neatly display sales data per item and month from a JSON object in HTML? You're in the right place! The JSON object contains information on items with their corresponding sales listed by month: var my_object= [{"item_id":"11","month":"Feb ...