Emulate the rounded corner images on a transparent background using CSS border-image-outset, even when the width is too large to be specified as

After searching online, I came across a potential solution to my issue using the CSS3 property border-image-outset. However, since no browser supports this yet, I am seeking assistance in finding an alternative solution. Thank you in advance for any help.

Here is the layout that a friend designed for me, which I am currently translating into HTML/CSS.

The main issue lies with the content area. The width is fixed, but the height varies depending on the content. It features a medium section with a repeated 1px high background image covering the entire width. However, there are also decorative corners on a transparent background that are too tall to extend beyond the content area. Additionally, there are different images above and below these corners, but that is no longer a concern with multiple background images.

How can I fill the content area .main with the repeated background without it showing behind the corners?

I have provided some examples to illustrate my problem, though most styles and images are still missing. The 1px paddings/borders are included for clarity.

Initially, I attempted a straightforward approach using one header and one footer image. However, I struggled to make the content overlap both the header and footer image while maintaining the desired height. See it here:

Next, I divided the image into approximately 100 pieces. Although I am only missing one small piece on the left side below the subnavigation, I am still facing the same challenge as before. View it here:

I have experimented with various techniques, resulting in a somewhat messy markup. Please disregard this for now, or feel free to start fresh. The only thing currently defined is the order and positioning of these two divs:

<div class="rechteSpalte">...</div>
<div class="mittlereSpalte">...</div>

I have created a fiddle with the second example for you to explore and test out your ideas.

Answer №1

You can achieve this without cutting your background image, except for separating the top piece and footer, of course.

Check out this solution that should be easy for you to customize:

Just envision the purple background as your top paper background and the yellow part as your repeating background. It will expand along with the text as needed.

UPDATE: The key here is to ensure that the content layer's text (within the p tag) has the highest z-index, while still maintaining a higher z-index for the top area over the repeating background's containing element.

Answer №2

Big thanks to @Jonah for helping me solve my code issue.

Check it out live here:

Extra divs are crucial to avoid negative margins directly on paragraphs in #content.

<html>
<head>
<style>
    body {
        background: darkgreen;
    }
    #top {
        background: url(http://test.illusionet.ch/jg/greengrass/img/header.png) no-repeat center top;
        height: 500px;
        margin: 0 auto;
        position: relative;
        width: 982px;
        z-index: 10;
    }
    #footer {
        background: url(http://test.illusionet.ch/jg/greengrass/img/bigfoot.png) no-repeat center bottom;
        height: 322px;
        margin: 0 auto;
        position: relative;
        width: 982px;
        z-index: 10;
    }
    #main {
        margin: 0 auto;
        width: 982px;
        background: yellow url(http://test.illusionet.ch/jg/greengrass/img/page.png) repeat-y right top;
        position: relative;
        z-index: 20;
        min-height: 100px;
    }
    #content {
        margin-top: -250px;
    }
    .clear {
        clear: both;
    }
    .neg_margin_hook {
        height: 1px;
    }
    .neg_margin_bottom {
        margin-bottom: -200px;
    }
    #content p {
        float: right;
        width: 30%;
        padding-right: 3%;
    }
    .left {
        margin-top:100px;
    }
</style>
</head>
<body>
    <div id="top">
    </div>
    <div id="main">
        <div class="neg_margin_hook">
        </div>
        <div id="content">
            <p class="right">Cras mattis consectetur purus sit amet fermentum. </p>
            <p class="center">the quick brown fox jumps over the lazy dog.  the quick brown fox jumps over the lazy dog.  the quick brown fox jumps over the lazy dog.  the quick brown fox jumps over.....
            <p class="left">Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>
            <div class="clear neg_margin_bottom">
            </div>
        </div>
    </div>
    <div id="footer">
    </div>
</body>
<html>

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

Obtain data from a local JSON file using the http.get() method in Angular 2

I am attempting to utilize the http.get() method in Angular 2 to load a local JSON file. I followed a suggestion from Stack Overflow that involves modifying my app.module.ts: In this example, I have imported the HttpModule and the JsonModule from @angular ...

AJAX Showdown: Comparing jQuery's AJAX API to JavaScript's XHR

tl;dr: I have two different scripts that appear to be identical, but one works while the other does not. Why is this? Let me provide some context for this post. I am working on creating an image uploading form that utilizes AJAX requests to generate a dyn ...

Open the PDF document in a stylish jQuery popup like fancybox or a similar plugin

Can a PDF file be loaded in a popup? I understand that some browsers may require Adobe Reader to view PDFs, but Chrome has its own built-in PDF viewer. ...

Extract the raw text content from nested elements

Working with highlight.js to include a custom CSS code, however, this library automatically adds span tags around the desired text For example: <pre> <code class="language-css hljs" contenteditable="true" id="css-code&quo ...

Is there a way to move a list item element to the right within a navigation tabs bar using Bootstrap 5?

I've been scouring the internet for tips on how to move my "User information" and "Logout" li elements to the right of my navbar using bootstrap, but I can't seem to find a solution. As a beginner with bootstrap, this task has proven to be quite ...

implementing a collapsible sidebar menu with CSS tables

I am working on a layout with three columns created using css tables to perfectly fit the browser window. The first column serves as a menu and I want it to hide or move to the left when clicked, allowing the middle column to expand into its space. However ...

Why is it that code that appears identical in the same browser and same size can look different when one version is deployed on localhost and the other remotely?

I've been working on a Material-UI Table where I customized the headers and table styles. While testing it locally with yarn start, it looked like this: https://i.stack.imgur.com/7yU2H.png However, when I viewed it on the remote system, it appeared ...

Looping in jQuery: Tips for Improving Performance

In my popup window, I have a JavaScript function that utilizes jQuery to retrieve checked checkboxes from the parent window. It then uses jQuery again to access associated data from hidden fields in the parent window for each checkbox. var chked = $(&apos ...

Closing Note in Drupal

Is there a way to adjust the footer message in Drupal without logging into the dashboard? I've checked all the files in cPanel, but I can't seem to locate the actual HTML for the website. I am only able to customize the body content, not the fo ...

CSS style takes precedence over inline JavaScript transitions occurring from a negative position

I am puzzled by a JavaScript fiddle I created which contains two small boxes inside a larger box. Upon clicking either of the buttons labeled "Run B" or "Run C", the corresponding box undergoes a CSS transition that is controlled by JavaScript. Below is t ...

Issue with FiFO on MacOs causes skewed borders to not display correctly

I am currently facing an issue with my webpage and would greatly appreciate some help from the community. My goal is to create a skewed border inside a div, similar to the example on this JSFiddle link: https://jsfiddle.net/kx6f9rsd/ .container { backgro ...

Utilizing Data Filters to Embed HTML in Vue.js?

I have been attempting to utilize the Filter feature in Vue.js to insert HTML tags within a String. The documentation indicates that this should be achievable, however, I am not having any success. The objective is for the data to be just a String that is ...

Tips on modifying the content of an element located within two iframes using the Chrome console

I'm trying to modify an element that is nested within two iframes. The issue I'm facing is that the Chrome console seems unable to locate the element. Is there a specific method to identify and target elements within nested iframes? document.quer ...

Tips on showing a specific div when a button is clicked using jQuery and Bootstrap

In my button group, I have four buttons and I need one specific button to display certain div content when clicked. The displayed content should be based on which button is clicked. Is there a way to achieve this using Twitter Bootstrap jQuery in ASP.NET ...

Retrieve the HTML code from a webpage on a different domain

Looking to extract HTML from another domain. Attempted solution: $.get("http://website1.com", function(data) { alert("Data Loaded: " + data); }); (not working) For example, as the owner of two websites: website1.com website2.com Now, the goal is to ret ...

Initiate an "execute.document" command directly from the address bar

While reviewing my old website, I stumbled upon this snippet: <input type="image" id="QuickPass" name="QuickPass" src="/images/QuickPass.gif" alt="Quick Pass" onclick="document.pressed=this.value" value="QuickPass" /> nestled within this form: & ...

Is there a way to extract the numerical value from a string within an ID of a div and transform the rest of the string into a variable?

Looking to extract the final id of a div and convert it to a variable. <div class="margin_bot" id="itemRows2"> <p id="rowNum1">...</p> <p id="rowNum2">...</p> <p id="rowNum3">...</p> <p id="rowNum4"> ...

Utilize Python and Selenium to post a comment on Instagram

Having some trouble with submitting comments on Instagram using Python and Selenium. The comment box on the Instagram web page has the following structure: <textarea aria-label="Añade un comentario..." placeholder="Añade un comentario..." class="Ypff ...

Using Bootstrap4 to merge rows into a single column or apply rowspan in Bootstrap

Hey there, I have a specific requirement that I need help with. Check out the image here. I want to enable the LCM information box when the LCM checkbox is checked. Below is my code: <div class="panel-body "> <div class="c ...

Toggling submenu visibility with click event in jQuery and HTML

As a newcomer to jQuery, I have successfully created a vertical menu. My objective is as follows: When the first list item is clicked, it should display the submenu. Clicking on the second list item will show the level 1 submenu while closing the first on ...