1

Please if i shouldn´t be posting this here can someone advise me where to post this instead?

TL;DR = Need my showcase image background to darken up!

I'm creating this website with new stuff i am learning in my online course to practice, and this will be the template where i will keep adding things.

I've had this before but i had to re-do this and can´t seem to make it work now.

My background used to be darker, i managed to this using a background image on a class, and then i also had somewhere in my style background rgba(0,0,0,0.5) which would darken my background and allow the text to be read perfectly.

Now whenever i try to do this i can't seem to make it work, i've tried using the before or after properties, using the rgba on a whole different div in the html but cant seem to do this?

background image link: https://postimg.cc/ZvSmDbgD

fiddle link: https://jsfiddle.net/Nuno11/Luhmernp/1/

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="/css/style.css">
  <link rel="stylesheet" media="screen and (max-width: 768px)" href="/css/mobile.css">
  <link rel="stylesheet" media="screen and (min-width: 1100px)" href="/css/widescreen.css">
  <title>Home</title>
</head>

<body id="home">

  <!-- navbar -->
  <div id="navbar-container">
    <nav id="navbar">
      <a href="#home">
        <h3>
          <span class="textPrimary">Pro</span>cessing...
        </h3>
      </a>
      <ul>
        <li><a href="#home">Home</a></li>
        <li><a href="#about">About</a></li>
        <li>Challenges <i class="fas fa-arrow-down"></i></li>
        <li><a href="contact.html">Contact</a></li>
      </ul>
    </nav>
  </div>

  <!-- Header: Showcase -->
  <div id="showcase-container">
    <header id="showcase">
      <div class="showcase-content">
        <h1 class="p2">
          <span class=textPrimary>Pro</span>cessing...
        </h1>
        <p class="p1">
          Space for creative learning, self-improving and testing.
        </p>
        <p class="p1">
          Building the blocks of a web developer.
        </p>
        <a href="about.html" class="btn">Find Out More</a>
      </div>
    </header>
  </div>


  <div id="footer-container">
    <footer id="footer">
      <p>
        Copyright &copy; Processing... 2020, All Rights Reserved.
      </p>
  </div>
  </footer>
  </div>

  <script src="https://kit.fontawesome.com/9751c7be27.js" crossorigin="anonymous"></script>
  <script src="java.js"></script>
</body>

</html>

Many thanks all

Nuno

Penny Liu
  • 15,447
  • 5
  • 79
  • 98
Nuno Carro
  • 75
  • 1
  • 8

1 Answers1

1

You can use a css trick :

 background: linear-gradient(rgba(0,0,0,.5), rgba(0,0,0,.5)),
    url('https://i.postimg.cc/kGV5GDy9/gray-metal-cubes-decorative-1005644.jpg');

Js fiddle: https://jsfiddle.net/hansfelix50/9hw2o5kp/

Hans Felix Ramos
  • 4,264
  • 3
  • 16
  • 40