Tips for creating child divs with a width that spans the entire page

When viewing multiple rows of containers on my page, the elements shift inline on smaller screens. I am looking to have the orange bar positioned behind and slightly below the header, spanning the width of the page. To achieve this, I utilized relative positioning and a negative z-index on the orange bar to push it under the title.

The query remains: How can I ensure that the backbar's width matches the screen while remaining within the container holding the title?

.backbar_orange {
    background-color: rgb(250, 105, 0);
    height: 80px;
    width: 100%;
    position: relative;
    top: 130px;
    z-index: -1;
}
<div class="container">

  <div class="row">
   <div class="col-md-6">
     
<div class="backbar_orange"></div>
     
    <h2>Sticker</h2>
<p>Content here</p>
     
   </div>
   <div class="col-md-6">
     <img src="img/stckr.jpg">
   </div>
  </div>
</div>

JSFiddle

I hope this explanation clarifies my design. Any suggestions or insight on achieving this with CSS rather than jQuery would be greatly appreciated as I lack experience in using jQuery.

Answer №1

It’s a bit unclear what you’re trying to achieve here, but from my perspective, the width corresponds to the size of my screen. If you are aiming to insert a backbar beneath the header, you can simply utilize CSS padding.

However, judging by the images provided, it appears that you want the width to align in a column next to an image or something of that sort.

In this case, you can make use of Bootstrap's grid capabilities as outlined here: http://getbootstrap.com/css/#grid

This will allow you to create two columns and specify their individual width, height, etc., for the divs contained within each column.

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

Guide on retrieving information from the World Bank API using jQuery/AJAX despite receiving a success status code of 200, but encountering an error

I am trying to retrieve data in JSON format using the code provided at this link: . Despite specifying dataType: jsonp, the request is returning a status 200 and the data is received but the success handler is not being triggered, instead the error block ...

Can a single character within a span be located and customized using only CSS techniques?

My inquisitive mind believes that the answer lies in the negative, however, CSS3 pseudo-selectors have the ability to work their magic almost like performing illusions on a stage. In an absurd context, I am determined to locate and style the period charac ...

The inclusion of HTTP header information within a jQuery file led to the unsuccessful loading of the jquery.js file

There's a strange issue occurring in my project. To give some context, the project is built using HTML, Extjs, and JSON. When the page loads in the browser, I noticed that header information is being dynamically added to the jQuery file. This unexpect ...

Refreshing an iFrame in NextJS from a different component

I am working on a NextJS application that includes a specific page structure: Page: import Layout from "@/components/app/Layout"; import Sidebar from "@/components/app/Sidebar"; export default function SiteIndex() { return ( < ...

Issue with clicking and toggling classes in Javascript

I am experimenting with creating a simple 3 slide slider, but I am facing some issues with the JavaScript. My goal is to have the current slider slide out and the selected one slide in when clicking on the slider color. I'm attempting to achieve this ...

Tips for extracting data from a JSON using a variable

I'm currently facing an issue in extracting data from a JSON file. I have declared a variable and am attempting to use its value to retrieve information from the JSON. However, I seem to be encountering an error that I can't identify. let e = &qu ...

Displaying JSON information using AngularJS

Hi there! I'm displaying some sample data retrieved from the server using AngularJS. In this code snippet, I have utilized the GetNames() function within ng-init. Is it appropriate to call this function in ng-init in order to display data when the pa ...

What is the best method to retrieve the title from an array using javascript?

I am working with a JSON object containing information on thousands of students. I have converted this JSON object into an array, and below is an example of how one array looks: [ 'Alex', { id: '0.0010733333111112', grade: &apos ...

Utilize the "require" keyword to bring in multiple items instead of using the "import" statement

I'm looking to incorporate Apollo Client into my project using the following syntax. import { ApolloClient, InMemoryCache, ApolloProvider, gql } from '@apollo/client'; However, my project setup only supports the use of the "require" keyword ...

The Simple HTML Dom parser is failing to parse contents on these specific websites

I tried using a basic HTML DOM parser but it's encountering issues when parsing certain websites. include_once 'simple_html_dom.php'; $html=file_get_html('http://www.lapenderiedechloe.com/'); This results in an error message like ...

Error: You can't use the 'await' keyword in this context

I encountered a strange issue while using a CLI that reads the capacitor.config.ts file. Every time the CLI reads the file, it throws a "ReferenceError: await is not defined" error. Interestingly, I faced a similar error with Vite in the past but cannot ...

Generate a list of JS and CSS paths for UglifyJS/UglifyCSS by parsing an HTML file

Seeking a tool that can scan an HTML file (specifically a Smarty template file) to extract paths from <script></script> and <link/> tags for use with UglifyJS/UglifyCSS or similar minification tools. Extra credit if it can handle download ...

Transforming a single object into several arrays

I have a JSON file called "icon.json" that contains the following data: [ { "name": "happy", "url": "1.gif" }, { "name": "excited", "url": "2.gif" }, { "name": "surprised", "url": "3.gif" ...

Display the date string in Material-UI TableCell格式

I have a TableCell component in Material-UI that displays dates in the format 2019-03-25T19:09:21Z: <TableCell align="left">{item.created_at}</TableCell> I want to change this to a more user-friendly format showing only the date as either 25/ ...

What is the way to display the final list item when clicking in jQuery?

I am attempting to achieve a specific behavior where clicking on a button will trigger the content below to scroll in such a way that only the last item in the list is visible. I have been using jQuery for this functionality, but unfortunately, it is not ...

An Illustrative Example of Inheritance in Javascript?

I've been searching on various platforms for a straightforward example of inheritance without much luck. The examples I've come across are either too complex, obscure, or just not user-friendly. I have multiple service functions that all share so ...

send JSON data to a Spring MVC endpoint

Here is the controller signature I have tried using @RequestBody: @RequestMapping(value = "/Lame", method = RequestMethod.POST) public @ResponseBody boolean getLame(@RequestParam String strToMatchA, @RequestParam String strToMatchB) {} This is the json I ...

What is the best way to execute a JavaScript function using Python Selenium?

Is it possible to repeatedly call the MapITRFtoWgs84() function with input from a text file and save the output to another text file? I believe Selenium might be the right tool for this task. Could you provide guidance on how to achieve this? Attached is ...

Running Intel XDK on my Windows 8 64-bit system - A step-by-step guide

Every time I try to open this app, it gets stuck on the "initializing" screen and nothing happens. I've tried uninstalling and reinstalling the latest version multiple times but the problem persists. I even tried downloading compatible node-webkit fil ...

What is the best way to finish up the JavaScript code below?

Having just started learning JavaScript, I am struggling to figure out how to use JavaScript to clear the text in a text box and move it below the box when a user starts typing. I've been watching this tutorial http://codepen.io/ehermanson/pen/KwKWEv ...