Create a CSS header with a fading background that extends horizontally to the left and right

I'm looking to create a header with a unique color transition effect - a left fade from light blue to blue, a center that is solid blue, and a right fade from blue to light blue. The header should span the full width of the page. Can anyone suggest the best way to achieve this using CSS, including background images for the fades on the sides and a centered header section? My current implementation is causing issues with overflow and restriction when resizing the browser window. Any advice would be greatly appreciated. Thank you!

 <div id="header">
<div id="leftfade"></div>
<div id="header_container">
   <div id="languagechooser"></div> 
    <div id="logo"></div>    
  <div id="navbar">
        <ul>
            <li class="navleft"><a href="aa.a">HOME</a></li>
            <li><a href="aa.a">xxxxxxxx</a></li>
            <li><a href="aa.a">xxxxxxxxxxxx</a></li>
            <li><a href="aa.a">xxxxxxxxxx</a></li>
            <li><a href="aa.a">xxxxxxxxxxxx</a></li>

        </ul>                                                             
    </div>                
</div>                     
<div id="rightfade"></div></div>

    body{
background: #FFFFFF;
margin: 0px auto;
font-size: 62.5%;
color:#000000;
width:100%;
min-width:965px;}
   #header{
position:relative;
height:157px;
background-color:#74d7ea;}
  #header #leftfade
  {
    float:left;
    background: url(../img/header_leftfade.png) repeat-y top left;
    width:25%;  
    height:157px;}
    #header #rightfade{
    position:absolute;
    right:0;
    background: url(../img/header_rightfade.png) repeat-y top right;
    width:25%;
    height:157px;}
    #header #header_container{

float:left;
position:relative;
text-align:left;
min-width:50%;
    height:157px;}
    #header #logo{
float:left;
background: url(../img/logo.png) no-repeat;
width:408px;
height:63px;
margin-top:20px;}
    #header #languagechooser{
float:right;
width:150px;
height:50px;
background-color:#ffffff;
margin-left:100px;}
    #header #navbar{
clear:both;
position:relative;
top:15px;
height:30px;
background-color:#63bdce;
width:98%;
 overflow:hidden;}
    #header #navbar ul{ list-style:none;}

    #header #navbar ul li{  float:left;}
    #header #navbar ul li a{
 background: url(navi_bg_divider.png) no-repeat right;
 padding-right: 12px;
 font: bold 1.7em Myriad Pro, Arial, Helvetica, sans-serif;
 padding-left: 12px;
 display: inline-block;
 line-height: 30px;
 text-decoration: none;
 color:#ffffff;}

Answer №1

To achieve a resizable gradient effect, consider implementing a CSS3 gradient instead of relying on images. Another option is to center the blue section using background-position:center;, allowing the white sections on the left and right to expand or contract based on the remaining space after resizing.

Answer №2

If you're looking to customize your website for different screen sizes, consider using CSS3 media queries for a dynamic output:

Check out this resource on how to implement it:

This approach could be very beneficial, but make sure to evaluate the browser support required beforehand.

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

Getting the hang of revealing a div through flashing

Is it possible to make a div flash using CSS alone? My goal is to have this div alternate between two colors. .chat-window .msg-container-base .notification-message-unread{ float: right; font-size: 10px; color: #666; background: white; padding ...

Moving from one section to the next within a web page

I am looking to add animation to my web app. When clicked, I want to move only the ID table column from one div to another div while hiding the other column. However, I am struggling with figuring out how to animate the movement of the ID column (from the ...

Issue with retrieving the current location while the map is being dragged

How can I retrieve the current latitude and longitude coordinates when the map is dragged? I've tried using the following code: google.maps.event.addListener(map, 'drag', function(event) { addMarker(event.latLng.lat(), event.la ...

problem with transmitting information through $.ajax

I'm facing a frustrating issue with the $.ajax()... function in my PHP code. I am unable to retrieve the data sent by the ajax request. <?php if ($_POST){ include 'Bdd_connexion.php'; $filiere = $_POST['filiere']; ...

JSON Novice - persistently storing data in JSON during browser refreshes

My AJAX poll was set up following a guide found here: http://www.w3schools.com/php/php_ajax_poll.asp Instead of storing the poll entries from an HTML radio button in an array within a text file as demonstrated in the tutorial, I wanted to save them in a J ...

Updating an HTML Table with AJAX Technology

I'm struggling to figure out how to refresh an HTML table using AJAX. Since I'm not the website developer, I don't have access to the server-side information. I've been unable to find a way to reload the table on this specific page: I ...

Arranging HTML elements using JavaScript or jQuery

Something seems off. The sorting doesn't work as expected. Check out the JavaScript code below: function sortDescending(a, b) { var date1 = $(a).data('date'); var date2 = $(b).data('date'); return date1 > date2; } ...

Using Node.js and the Jade templating engine, display the value of a passed variable

Asking such a basic question makes me feel guilty. app.get('/skumanagement/:id', function (req, res){ var options = req.params.id; // req.params.id = itemidx database.skuGetDetail(options, function (error, data){ winston.log('inf ...

Arranging rows of a specific height within a table at any location

I need to create a virtual table to browse through a very large dataset. Is there a way to position the rows (with fixed height) anywhere within the table? The issue I am facing is that the table properties automatically adjust the row height, disregarding ...

Tips for preventing the appearance of a horizontal scroll bar when utilizing the FlexLayoutModule in Angular

import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-property-feed', templateUrl: './property-feed.component.html', styleUrls: ['./property-feed.component.scss'] }) export class Prope ...

What is causing the SVG element to malfunction on iOS devices?

I am facing an issue with the <h1> tag in my design. The SVG element within it is not appearing on mobile phones when I write a media query for devices with a minimum width of 400px, even though it works fine on screens with a minimum width of 800px. ...

Is there a way to showcase whitespacing in HTML?

I have a database full of content that includes whitespace formatting for display on a webpage. However, when viewed on Stackoverflow using the code tag, the formatting changes. The second way shows how it is stored in the database and how I want it to app ...

Move a <div> using a handle (without using JQuery)

I devised a plan to create a moveable div with a handle and came up with this code snippet: var mydragg = function() { return { move: function(divid, xpos, ypos) { divid.style.left = xpos + 'px'; divid.style.top = ypos + &apo ...

Struggling to create responsive embedded videos?

https://i.sstatic.net/R0GUn.jpgI have successfully created a responsive video, but there seems to be an issue with the width to height ratio when the browser is fully stretched. The iframe appears narrow and tall in this situation. However, when the browse ...

Apply the CSS style specifically to the initial row in the table

Is there a way to target the first row of a table with a different tr class using CSS? <div id="right"> <table> <tbody> <tr class="head"> <td >Date</td><td>Info</td><td>More</td> </tr> ...

The height on iPad Chrome is displaying incorrectly

iPad Pro(11-inch), iPadOS version: 16.6.1, Chrome version: 116.0.5845.177 I tried running a simple html file on my iPad and encountered an issue. Despite setting the height to 100vh, a vertical scrollbar appeared on the right side of the screen allowing ...

Slide your cursor over to reveal a picture

I'm looking to create an interactive image gallery where the user can hover over an image to reveal text below it. I've been trying to achieve this by setting up my images in a specific way: echo "<div class=textimage style=background-image:u ...

Form-linked Progress Bar

This is a little project I created (for fun and learning purposes, even though it may not be the most optimized solution). If you're interested, here's the link to the code: https://codepen.io/paschos/pen/xxGXMQb I'm currently seeking assi ...

The iframe came to a halt as soon as it was no

I am currently developing a live video website that utilizes third-party tools to play the videos. To simplify things, I have embedded all the components required for live video into a single HTML page. Here is how it looks: <iframe data-v-140cfad2= ...

Issue encountered while incorporating a PHP file into Javascript code

I'm facing a particular issue where I have a PHP file that is supposed to provide me with a JSON object for display in my HTML file. Everything seems to be working fine as I am receiving an output that resembles a JSON object. Here's the PHP file ...