Is it possible to reduce the brightness of a background image that has already been added?

I am encountering a situation that I find difficult to put into words. I have added an image as a 'background-image' and although it is small, it suits my needs as I am still learning. However, the issue lies in the brightness of the second repeat image and I am unsure how to remove it.

HTML:

<html>
    <head>
        <link rel="stylesheet" href="index.css">
    </head>
    <body>
       <h1>Blackjack</h1>
       <p id="message-el">Want to play a round?</p>
       <p id="cards-el">Cards: </p>
       <p id="sum-el">Sum: </p>
       <button onclick="startGame()">Start Game</button>
       <button onclick="newCard()">New Card</button>
       <script src="index.js"></script>
    </body>
</html>

CSS:

body{
    text-align: center;
    font-weight: bold;
    color: white;
    background-image: url(https://st4.depositphotos.com/5134503/i/600/depositphotos_223688152-stock-photo-dark-green-poker-table-felt.jpg);
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', Arial, sans-serif;
    background-size: cover;
}

h1{
    color: goldenrod;
}

#message-el{
    font-style: italic;
}

button{
    display: block;
    margin: auto;
    color: #016f32;
    background: goldenrod;
    width: 200px;
    padding-top: 5px;
    padding-bottom: 5px;
    font-weight: bold;
    border: none;
    border-radius: 2px;
    margin-top: 5px;
    margin-bottom: 5px;
    
}

https://i.sstatic.net/MZLgD.png

Answer №1

The issue does not lie with the brightness but rather with your source image. The top and bottom of the image are not aligned properly. One quick solution is to duplicate the image and flip it, as demonstrated in Photoshop (refer to snippet). Alternatively, you can adjust the original image using tools like offset, blur, and clone in Photoshop to ensure that the top and bottom match perfectly for a seamless repeat.

 
   body{
    text-align: center;
    font-weight: bold;
    color: white;
    background-image: url('https://i.sstatic.net/U14VE.jpg');
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', Arial, sans-serif;
    background-size: cover;
}

h1{
    color: goldenrod;
}

#message-el{
    font-style: italic;
}

button{
    display: block;
    margin: auto;
    color: #016f32;
    background: goldenrod;
    width: 200px;
    padding-top: 5px;
    padding-bottom: 5px;
    font-weight: bold;
    border: none;
    border-radius: 2px;
    margin-top: 5px;
    margin-bottom: 5px;
    
}
<!DOCTYPE html>
<html>


<head>
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no,
shrink-to-fit=no" />

</head>

<body>
       <h1>Blackjack</h1>
       <p id="message-el">Want to play a round?</p>
       <p id="cards-el">Cards: </p>
       <p id="sum-el">Sum: </p>
       <button onclick="startGame()">Start Game</button>
       <button onclick="newCard()">New Card</button>
       <script src="index.js"></script>


</body>

</html>

Answer №2

One way to decrease the brightness of an image is by using the CSS function for brightness adjustment.

.image {
    filter: brightness(50%);
}

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

Displaying the division of shares in an HTML table using jQuery to add a new row

I recently worked on transposing a table, adding classes and ids to specific HTML tags, and converting numbers with commas into integers. Now, I am attempting to calculate the percentage share and display it in a new row. Here is the original table for re ...

Troubleshooting on Safari for iOS

As I work on my portfolio website using only HTML 5 without any JavaScript, I encountered an issue with the about page not functioning properly on iPhones. There seems to be a problem with scrolling as some elements are fixed and do not move along with t ...

Expand the div width to the specified measurement horizontally

Is there a way to horizontally collapse a div (container) to a specific width that I can adjust, effectively hiding its content? The collapse effect should move towards the left. <div id="container"> <button type="button" id="myButton"> ...

Problems with navigation alignment in Flask website due to HTML, CSS, and

Here's a snapshot of my current website design: website I'm attempting to place the Login & Sign up buttons in line with the rest of the navigation bar. I've tried various methods without success so far. My attempts include adjusting text a ...

Best placement for transition effects in a dropdown menu animation

<div class="dropdown"> <button class="dropbtn">ALAT</button> <div class="dropdown-content"> <a href="index2.php"><img src="home.jpg" class="home" width="7 ...

Tips for effectively utilizing an if/else structure to animate fresh content from the right while smoothly removing old content by sliding it to the left

document.getElementById("button1").addEventListener("click", mouseOver1); function mouseOver1(){ document.getElementById("button1").style.color = "red"; } document.getElementById("button2").addEventListener("click", mouseOver); function mous ...

Align text to the left and right with a centered div

Visualize the asterisk * at the center of the div textAlignRight * text AlignLeft This is essentially my goal to accomplish <center> <span class="left_host">Right aligned</span> * <span class="righ ...

What should I do to resolve the issue of the function if ($(window).width() < 768) {} not functioning properly upon resizing the browser?

I am working on a functionality where the navigation bar items will toggle hidden or shown only when the browser width is less than 768px and an element with the class "navlogo" is clicked. I have included my code below for reference. if ($(window).width( ...

Using jQuery to animate a DIV sliding in from the side

When a user scrolls down (x) pixels, I'm smoothly sliding a DIV into the viewport horizontally. If the user scrolls back up, the DIV scrolls out again. However, the sliding motion appears jerky and pauses at certain moments. <div id="doom_o">&l ...

Adding color between lines in Three.js

I have two different sets of vertices. One set contains real vertices, and the other set contains the same vertices but with a y value of zero. I am trying to connect these vertices and fill them in but have not been successful so far. I have attempted to ...

What is the largest image dimension allowed for website use?

What are the dimensions in pixels and file size in MB? I've been curious about this for a while, appreciate any insights! ...

How to toggle the visibility of specific div elements within a v-for loop depending on their content?

I am working on a scenario where I have a collection of objects displayed in a v-for loop. Each object has a specific key value pair, and I want the user to be able to toggle a button outside the loop to show or hide elements based on that key value. Initi ...

The Impact of CSS Border Width on the Size of a PHP Form

Creating a PHP form with a tabbed box has been quite the challenge. With 3 tabs, each requiring different field inputs, I set out to add a border around the form headings and tabs. The border looks great, but it poses a problem - its width spans the entire ...

Creating a Collage with Varied Image Sizes

Hey there, I'm trying to achieve something that seems simple, but I can't quite figure it out. What I want to do is query a table and display the results in two separate divs on my webpage. Here's an example of the HTML structure I have: &l ...

Align one item in the center with several other elements

I have a div containing multiple spans with varying widths. While I know that using text-align: center can center all content within the div, my goal is to specifically designate one span as the true center, rather than having the center be the average of ...

Show the selected values of different checkboxes

Can anyone assist me with jQuery? I have an easyui accordion containing text and checkboxes, with multiple inputs within each accordion. The values of the inputs are retrieved from PHP arrays. I am trying to display the value of each input when checked ( ...

What is the best way to incorporate an AJAX GET request into an HTML element?

Currently, I am attempting to execute a JavaScript code that will convert all <a></a> elements found within another element <b></b> (the specific name in the HTML) into links that trigger an HTTP get request. However, the code I hav ...

Irregular dimensions of div elements following automated selection

My tile div can be selected using the mouse or a timed event. Here are the states of selected and unselected : Not .selected .selected applied .tile { height: 70px; padding: 5px 10px 5px 10px; margin: 8px auto 0px auto; width: 280px; ...

Tips on extracting the value from an HTML input control

Looking for some assistance with a table generated by a 3rd party control. The table consists of only one row and one column containing HTML text like this: <p> this is a test</p> <p> <input name="amount" type="text" value="th ...

Sending documents to a printer directly from a Rails application

Is there a library or gem in Rails that can be used to print the contents of a web page directly onto paper? I am curious if it's possible to specify only a specific part of the page, such as a div, for printing. Any guidance, advice, or tutorial link ...