Is there a way to show text with a transparent background color over another background image or text?
I am looking to include text over existing text
Is there a way to show text with a transparent background color over another background image or text?
I am looking to include text over existing text
Is this what you had in mind? The key technique here involves using rgba
for the background-color
, with the opacity (alpha channel) specified as the last parameter.
.container {
position: relative;
text-align: center;
color: white;
width:300px;
}
.container__image{
width:100%;
}
.container__text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size:26px;
color:red;
background-color: rgba(0, 0, 0, 0.5);
}
<div class="container">
<img src="https://picsum.photos/300/300" class="container__image"/>
<span class="container__text">Some text</span>
</div>
I'm having an issue with my code where both <div> elements run together when I refresh the page. I want them to display separately when each radio button is clicked. <input type="radio" name="cardType" id="one" class="css-checkbox" value="db ...
I'm currently working on a code snippet that validates when the user moves away from a specific select element. The goal is to change the border color of the select element to either red or green only when the user tabs away from it or moves the mouse ...
My HTML page consists of just one div. The body code is as follows: <div> </div> Here is the corresponding CSS: body { margin:0; height:100vh; width:100vh; } div { height:100vh; width:100vh; color:#000000; } I c ...
let newColumnBlock = $('<div class="col-md-2">'); let newImagePoster = $('<img>'); let newSelectButton = $('<a href="secondPage.html"><button class="selectButton"></button></a>'); let movie ...
I am attempting to align the content as a footer, but having trouble with the dropup not lining up properly: <footer class="footer"> <div class="container-fluid"> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12"> &l ...
I created a table that allows users to set a marker on a specific row by adding a 5px border to the left side of the row. Interestingly, when the border is added to the first row, the table gets padded on the right by a few pixels. However, this padding d ...
I'm currently working with a static bootstrap navbar and trying to center a search box within it. Unfortunately, all my attempts have been unsuccessful so far. The search box either appears below the navbar or doesn't display at all. At this poin ...
check out the demo Here is a demonstration of HTML elements: <div class="controller"> <div><a href="#buttton-1">Special Offer</a></div> </div> And here is the styled CSS for the demo: .controller{ width: 55px; ...
Is it possible to retrieve the value of a text box in an iframe from the parent page upon clicking a button? Below is an example code snippet showcasing the situation: <div> <iframe src="test.html" > <input type=text id="parent_text"> & ...
I am struggling with aligning buttons to the right side of a div while keeping everything displayed in line. Currently, the buttons appear below the span rather than beside it. I have attempted setting the button's display to "inline" and "inline-bloc ...
I am experiencing an issue with the functionality of my amCharts maps. Whenever I refresh the page, the circles that are supposed to be displayed disappear. However, when I zoom in, the circles reappear. This problem has me puzzled, and I'm not sure ...
Hey there, I'm currently facing some issues that I can't seem to solve. I've tried various solutions but none of them are working for me. My goal is to center the content of one div inside another. I prefer using only auto or % values as I ...
I am trying to adjust the sliding image on my webpage's page banner so that it appears in the center instead of floating to the left or right. Here is the HTML code: <ul class"rslides" id="slides"> <li><img src"image/test.jpg">&l ...
I am facing an issue where I need to change the class of a span child using a toggle feature when clicking on a browser row. The problem arises when there are multiple rows, as the span cannot be found and the functionality does not work properly. I have ...
I encountered an error while working on angular routing. Below is my HTML code snippet: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <script src= ...
For a while now, I've been trying to solve the issue with radio button validation in my current project. Surprisingly, it works fine when there are no other functions in the form besides the radio buttons themselves. I suspect that the problem lies wi ...
I am currently working with a bootstrap carousel that contains both portrait and landscape images. On wide screens, the carousel height is automatically set to match the tallest image's height. However, this behavior results in white spaces on the top ...
I currently have a CSS code that triggers a message box through media query when the screen is resized to a specific size. I am looking for a way to make the message box disappear automatically after 5 seconds. Do you have any suggestions on how to achiev ...
Does anyone know how to retrieve images from a MySQL database and display them in rows of three horizontally, while also having a relevant image show on top? I'm struggling with this task. Below is the code snippet for the main div: <div class="co ...
Is there a more efficient way to use file_get_contents() on an html file containing 3 variables and have those variables populated with data from $_POST? For example: -html file- <html> . . <table> <tr> <td> ...