L
L
lue merg2015-08-22 15:11:03
JavaScript
lue merg, 2015-08-22 15:11:03

Does not display background-color on top of the image, how to fix it?

it turns out that there
11d2a1cd32744e92b704c46159618664.png
should be a black transparent background for the headings here is part of the html
code

<div class="item">
  <div class="item-inner">
    <img src="https://pp.vk.me/c622026/v622026294/e4ef/Nxw6qvyQ60E.jpg" class="center">
    <p class="spec">accessory</p>
  </div>
</div>

css
.item {
  width:33%;
  height:300px;
  padding-left:15px;
  padding-right:15px;
  display:inline-block;
}
.item-inner {
  border:5px solid #4f1404;
  height:100%;
  overflow: hidden;
}
.item-inner img {
  height:100%;
}
.center {
  margin: 0px -100px;
}
.spec {
  color:white;
  margin-top:-50px;
  font-size:20px;
  background-color:rgba(0, 0, 0, 0.8);
}

Answer the question

In order to leave comments, you need to log in

5 answer(s)
P
Pavel Kornilov, 2019-02-26
@KorniloFF

If I understand correctly, then you can do this - https://codepen.io/KorniloFF/pen/BbyNLe?editors=1010

A
Alex, 2019-02-26
@Kozack

So put your URLs inside the tags IMG, but don't show the tags themselves. The browser will load the data, and when needed you will simply show the tags IMGthat have already been loaded

S
Sergey, 2015-08-22
@luemerg

Add to .spec
Did you want this?

G
gleendo, 2015-08-22
@evgeniy8705

Everything is working! codepen.io/evg_/pen/JdQqjV

L
lue merg, 2015-08-22
@luemerg

you can play around here
codepen.io/anon/pen/QbXRbq

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question