Dark film over background in CSS

Hey everyone!
Still fairly new to front end development for websites. I am trying to get a dark opacity cover over a background image. I have tried using CSS with a black background but I just can’t seem to get it to my liking. I have also tried using linear-gradient but still not what I am looking for.

Any help will be greatly appreciated.

Want to get something like this…

but stuck with something like this…

Here’s the css code I am using:

#topbg img{
linear-gradient(to top rgba(0,0,0, 1.0), rgba(0,0,0, 1.0)),
background-size: cover;
color: black;
padding: 20px;
opacity: .9;