Design a unique cross-shaped watermark using CSS

I am looking to create a unique cross image that will be displayed within a variable height Div 1. How can I achieve this result?

This is what I have attempted so far:

.cross01 {
width:520px;
height:100%;
background:url(../images/cross01.png) repeat-y;
position:absolute;
top:0px;
z-index:1000;
}

Answer №1

One option is to wrap the images in a container and utilize an after selector.

VIEW DEMO

CSS

.watermark {
    position: relative;
}
.watermark:after {
    background: none repeat scroll 0 0 rgba(255, 255, 255, 0.8);
    bottom: 0;
    content: " ";
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

HTML

<div class="watermark">
    <img src="http://ecx.images-amazon.com/images/I/61BcAJJgyXL._SX450_.jpg"></img>
</div>
<div>
    <img src="http://ecx.images-amazon.com/images/I/61BcAJJgyXL._SX450_.jpg"></img>
</div>

Answer №2

It seems like you want to accomplish the following:

To achieve this, adjust the position attribute of Div1 to relative and create a child div with an absolute position. Place the watermark image or text within the child div and ensure all your content is inside the parent div. Position the watermark div above all other contents by using z-index:1.

I hope this explanation clarifies things for you.

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

How can I dynamically insert HTML content into a data-attribute using JavaScript?

I have been trying to insert a variable that includes HTML code into a DATA attribute (a href ... data-content= ...), but it isn't functioning properly. The code I input seems to delete certain characters and as a result, it does not display correctly ...

Building a Dynamic CSS Grid

Today is the first time I'm reaching out for help rather than figuring things out on my own. I'm currently working on a website layout that consists of visible tiles all with equal sizes, forming a grid structure. The challenge I face is making t ...

Dealing with Unwanted Navbar Opacity in Bootstrap 4

Currently working on a React.js project using Bootstrap 4. The issue I'm facing involves two elements - navbar and alert, both implemented from Bootstrap4. Strangely, when setting position:fixed for both elements (overriding CSS), they become semi-tra ...

hide content on both desktop and mobile devices

I can't seem to figure out what's wrong here and my mind is blank. I have 2 tables - one for desktop users and one for mobile users. I attempted to hide one using the display none property in my code. .mobile{display: none;} This CSS was mean ...

How can you gradually make a CSS border disappear?

Can an element's border fade away with the use of JavaScript only, without relying on jQuery for animation? We are currently working with Sencha and it seems that ExtJS only allows for animating element size and position. While CSS3 offers helpful ani ...

Removing the Yellow Highlight on Input Field Following Email Autocomplete in Chrome

My username-password form is styled and working perfectly, but there's an issue that arises when I log in multiple times. Chrome automatically fills in my email, turning the username textbox yellow. It doesn't seem to happen with Firefox or Safar ...

Struggling to create a photo grid design that meets my expectations

I'm struggling to recreate this particular photo grid. Any tips on how I can achieve it? Check out the image here Just to clarify, I had a working prototype see image description using flexbox. However, one image didn't fit well so I resorted to ...

What is the best way to incorporate hyperlinks or text color modifications to a variable string in JavaScript?

I have a website that features a random on-load slideshow with text displayed in div containers for each slide. I am looking to enhance the functionality by adding links or changing the color of specific words within the text. You can view my current progr ...

Modify the Calendly widget CSS with a media query to adapt it to different screen sizes

Hey there, I'm new to CSS and I'm struggling with getting rid of the vertical scroll bar that shows up on mobile for a calendly widget. Here's the embed code for the widget: <div class="calendly-inline-widget" data-url="https://cale ...

Issue with Bootstrap gradient mixin functionality in Internet Explorer 9

I recently obtained this code after compiling a bootstrap gradient less mixin: html, body { height: 100%; background-image: -webkit-linear-gradient(top, rgba(108, 91, 123, 0.8) 0%, rgba(53, 92, 125, 0.8) 100%); background-image: -o-linear-grad ...

Discovering descendant div elements

I've been conducting some research, but I'm struggling to find a specific answer for this. Here is the HTML code snippet: <div class="collapsingHeader"> <div class="listItemWrapper"> <div class="itemWrapper"> ...

Ways to left-align the columns themselves, rather than the content within them, in a table

Creating a table without knowing the number of columns in advance can be tricky. If you have a wider first column and want the rest to be the same width, it's important to align them properly so they fill the space on the left and leave room on the ri ...

When the React js application is opened in a hosted environment, the CSS styling may be overridden

My React js application is hosted within another application. When a jQuery dialog opens, the React application also launches. While the functionality works correctly, some of the CSS styles are appearing incorrectly. I suspect that either the CSS from the ...

What could be causing the svg to not be visible inside the div?

I am struggling to display an SVG element within a div as it is not visible at all. Can someone help me make the SVG visible in the div? Here is a link to the code: http://codepen.io/helloworld/pen/HjkhK <div style="height:100px;background:yellow;"> ...

Expanding on the specific properties of a parent component to its child, using SASS's extend feature

Can selected or specific properties be shared/extended from the parent to the child without the need to create a variable? .main-container { padding: 20px; margin: 20px; ul { padding:$parentPadding(); margin: 0; } ...

Having trouble arranging the elements when swapping within a pop-up modal

When I drag and drop two divs inside a modal popup, their positions shift down during the animation. I am struggling to fix this issue. HTML Code: <title> Tile Swapping with Animation</title> <body> <button type="button" class=" ...

The stylesheet displays correctly in Grover debug mode, but does not appear in the downloaded PDF file

Having some trouble applying CSS to Grover, a tool I'm using to render and download PDF copies of documents generated in my app. While the CSS renders as expected in Grover's debug mode (rendered in Chromium), it seems that my application.css is ...

What is the best way to sign up for input so that any modifications are automatically saved to an object?

My HTML form input looks like this: <mat-form-field appearance="fill"> <mat-label>Flowrate: </mat-label> <input id = "flowRate" type="number" matInput> </mat-form-field> In my .ts file ...

Adding a <tr> tag to an HTML table using JQuery and AJAX in the context of Django framework step by step

I am currently navigating the world of Javascript, Jquery, and Ajax requests and I'm encountering a challenge with how my scripts are executing. My homepage contains a lengthy list of items (over 1200) that need to be displayed. Previously, I loaded ...