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

Verify that the source of an image within a JSON file is blank by utilizing jQuery

I am attempting to retrieve images from Google using the Google Knowledge Graph Search API Link in JavaScript and jQuery. The JSON data returned by Google resembles the example below: { "@context": { "@vocab": "http://schema.org/", "goog": "http ...

What is the best way to design a shape (a quadrilateral with rounded edges) using CSS?

Struggling with creating a widget in React Js that has an image as the background? The image is designed to be dynamic, changing color and size based on the device. I've attempted using inline SVG and SVG within an img tag but can't seem to contr ...

Utilize Bootstrap multiselect for extracting values from optgroups and options

Having a select element with optgroups and bonded values, the structure is as follows: <select id="example-dataprovider-optgroups" multiple="multiple"> <optgroup label="Lime No. 2" value="b3a2eff6-5351-4b0f-986 ...

Is there a way to prevent HTML Tidy from inserting newlines before closing tags?

Have you ever noticed how HTML Tidy always seems to add an extra newline before the closing tag? It's so frustrating! For instance: <p>Some text</p> ends up looking like this: <p>Some text </p> Is there a way to make Tidy k ...

Pattern to filter out numeric values from a collection

I want to apply a regex pattern to the <input> form element. The pattern should specify a range of numbers that are not permitted as input. For example, let's say I have a list of numbers like {1,4,10}, and any number other than these should b ...

Removing scrollbar from table in React using Material UI

I successfully created a basic table using react and material UI by following the instructions found at: https://material-ui.com/components/tables/#table. The table is functioning properly, but I am finding the scrollbar to be a bit inconvenient. https:// ...

Struggling to showcase array data in a visually appealing table format?

Hello, I am currently facing the following issue Here is a snapshot of my current website; https://i.sstatic.net/pNXNx.png I am trying to display content in a table from an array stored in a JSON file. Initially, I used a foreach loop which worked perfe ...

What are the best practices for managing large amounts of data using jQuery and PHP with AJAX?

When I attempt to pass a large JavaScript array to PHP using the $.ajax method of jQuery, with Content-Type set as JSON and data sent as RAW, I encounter an issue. In PHP, I retrieve the data using file_get_contents('php://input'). Despite every ...

"Is there a way to target an element within another element that has inline styles using

What is the best CSS strategy for targeting elements with inline styles? How can I focus on the first span but exclude the second using only CSS? If that's not achievable, is it possible to accomplish this using jQuery? http://jsfiddle.net/TYCNE/ & ...

Is it possible to ensure that two form fields are identical using HTML?

Is it possible to enforce that the content in two form fields matches using HTML alone, or is JavaScript still necessary? For instance, if you have two password fields and desire to validate that a user has inputted identical data in both fields, are the ...

Retrieving Mouse Coordinates using Ajax in PHP

I'm wondering if it's feasible to send an Ajax request with mouse coordinates using PHP. For instance, I am fetching a page with cUrl and would like to trigger a mouse movement event on that page. At this point, I haven't written any code ...

What could be causing the alignment issue with cells in Bootstrap?

I'm currently facing an issue with Bootstrap where two columns that are supposed to appear side-by-side on medium resolution end up displaying one below the other. You can view a screenshot of the problem here, and the code can be found at this link. ...

Modifying the rows of an HTML table with jQuery: A step-by-step guide

I have an HTML table that I need to update its content. <div id='adf'> <table id='tbl1' runat='server' > <tr><td></td></tr> </table> </div> To update the table&apo ...

Guide on aligning text to the center in the navigation bar

I am currently experimenting with a dropdown navigation bar using pure CSS. However, I am facing issues with text alignment as it only aligns the dropdown text. Setting left: 50% and right: 50% does center the text, but it doesn't cover the width of m ...

Achieving auto-height for two elements with CSS within a single block

I am attempting to combine two blocks into one fixed-height block in order to achieve the following design: ------------------------ UL (starts with height=0), expands when elements are added until maximum height is reached scroll bar should appear aft ...

When AJAX is invoked, the HTML content fails to display within a div

The following is the ajax script I am currently utilizing: mypage.php $(".sales_anchor").click(function(e) { e.preventDefault(); var store_username = $("#storeUsername").val(); var store_id = $("#storeID").val(); var sale_id = $(this).a ...

Using jQuery to modify CSS properties in the propertyName

With jQuery v1.6.4, I am attempting to dynamically format some objects. Take a look at my code snippet: <html> <head> <script src="http://code.jquery.com/jquery-1.6.4.min.js" type="text/javascript"></script> <script type="text ...

Issues with CSS hover event causing animation to fail to trigger

I have a container that contains an image holder and a text holder. I am able to set it so that when hovered over, the image scales and the same effect applies to the text. However, when attempting to set up the image holder hover to scale the image and ...

Gathering information in a non-blocking manner with $.ajax() in rails version 3.2.2

Currently, I am delving into the realm of asynchronous data retrieval in my Rails 3.2.2 project. As a newcomer to both JavaScript and jQuery, I've stumbled upon an issue where JavaScript is unable to fetch data from a different domain server. To overc ...

JavaScript regex problem

As I am handling a specific string: £1,134.00 (£1,360.80 inc VAT) I am currently attempting to isolate the numerical values as follows: ['1,134.00','1,360.80'] My approach involves utilizing this regex pattern in Javascript: /&bs ...