HTML CSS - Organize images (figure) with captions (figcaption) on the page?

1

I'm having difficulty putting the caption inside my image, I want the caption to be at the bottom of the image (inside it), another thing is that my section.galeria is not inside my div # interface and I also can not centralize it.

@charset "UTF-8";
.postagem {
	background-color: rgba(255,140,40,.05);
	margin: 0px;
}
#interface {
	width: 1200px;
	background-color: white;
	margin: 90px auto 10px auto;
	box-shadow: 0px 4px 6px 3px rgba(0,0,0,.1);
}

.cabecalho {
	transition: 0.2s;
	top: 0px;
	position: fixed;
	width: 100%;
	height: 35px;
	background-color: rgba(255,140,40,1);
	margin: 0px;
	padding-bottom: 20px;
	padding-top: 20px;
	text-align: center;
}	
.logo {
	margin: 0px 0px 0px 0px;
	color: rgba(255,255,255,1);
	font-family: agency fb;
	font-size: 20pt;
	/*display: inline-block;*/
}
#fcor {
	color: rgba(255,220,180,1);
}
.galeria {
	margin-left: auto;
	padding: 20px;
	width: 1200px;
	}
.legenda {
	position: absolute;
	text-align: center;
}
.imgp{
	position: relative;
	margin: 10px;
	padding: 0px;
	width: 200px;
	height: 200px;
	background-color: white;
	box-shadow: 1px 1px 3px rgba(0,0,0,.4);
	float: left;
}
/*Postagens*/

#postagem02 {
	background-color: white;
	background: url("../_imagens/win10.jpg") no-repeat;
	background-size: 200px 200px;
}
#postagem03 {
	background-color: white;
	background: url("../_imagens/oracle.png") no-repeat;
	background-size: 200px 200px;
}
#postagem05 {
	background-color: white;
	background: url("../_imagens/vnc.png") no-repeat;
	background-size: 200px 200px;
}
#postagem04 {
	background-color: white;
	background: url("../_imagens/office.jpg") no-repeat;
	background-size: 200px 200px;
}
<!DOCTYPE html>
<html lang="pt-br">
<head>
	<meta charset="UTF-8">
	<title>Processos e Manuais de Instruções</title>
	<link rel="stylesheet" type="text/css" href="_css/estilo.css"/>
	<link rel="stylesheet" type="text/css" href="_css/fotos.css"/>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><script>$(document).scroll(function(){vary=$(this).scrollTop();if(y<25){$('.cabecalho').css({'padding-top':'20px','padding-bottom':'20px'});}else{$('.cabecalho').css({'padding-top':'5px','padding-bottom':'0px'});}});</script></head><bodyclass="postagem">
		<header class="cabecalho">
			<h1 class="logo">MANUAIS E PROCESSOS<span id="fcor"> INFORMÁTICA<span><h1/>
		</header>
	<div id="interface">
		<section class="galeria">
			<a href="_postagem/1009182.html"><figure><img class="imgp" src="https://image.ibb.co/cXVJ79/check.jpg"><figcaptionclass="legenda">Legenda Checklist</figcaption></figure></a>
			<a href="_postagem/1009182.html"><figure><img class="imgp" src="https://image.ibb.co/gabEfU/win10.jpg"><figcaptionclass="legenda">Legenda Windows 10</figcaption><a href="_postagem/1009181.html"></a></figure>
			<a href="_postagem/1009182.html"><figure><img class="imgp" src="https://image.ibb.co/eiiGup/oracle.png"><figcaptionclass="legenda">Legenda Oracle</figcaption><a href="_postagem/1009182.html"></a></figure>
			<a href="_postagem/1009182.html"><figure><img class="imgp" src="https://image.ibb.co/deNLLU/office.png"><figcaptionclass="legenda">Legenda Office</figcaption><a href="_postagem/1009182.html"></a></figure>
			<a href="_postagem/1009182.html"><figure><img class="imgp" src="https://image.ibb.co/cRLwup/vnc.png"><figcaptionclass="legenda">Legenda VNC</figcaption><a href="_postagem/1009182.html"></a></figure>
			
		</section>
	</div>
</body>
</html>
    
asked by anonymous 13.09.2018 / 15:01

1 answer

1

Dude your HTML structure had some problems, type one a <a> tag inside another <a> tag. This is not correct. Another problem is that you use float: left on some elements, so it was giving the impression that section.galeria was not within div#interface . Also, some position were in the wrong place ...

I made some adjustments and now I think it was as you wanted. Take a look, display as "All Page" to see the result better:

$(document).scroll(function () {
  var y = $(this).scrollTop();
  if (y < 25) {
    $('.cabecalho').css({
      'padding-top': '20px',
      'padding-bottom': '20px'
    });
  } else {
    $('.cabecalho').css({
      'padding-top': '5px',
      'padding-bottom': '0px'
    });
  }
});
@charset "UTF-8";

.postagem {
  background-color: rgba(255, 140, 40, .05);
  margin: 0px;
}

#interface {
  width: 1200px;
  background-color: white;
  margin: 90px auto 10px auto;
  box-shadow: 0px 4px 6px 3px rgba(0, 0, 0, .1);
}

#interface::after,
.galeria::after {
  content: "";
  display: table;
  clear: both;
}

.cabecalho {
  transition: 0.2s;
  top: 0px;
  position: fixed;
  width: 100%;
  height: 35px;
  background-color: rgba(255, 140, 40, 1);
  margin: 0px;
  padding-bottom: 20px;
  padding-top: 20px;
  text-align: center;
}

.logo {
  margin: 0px 0px 0px 0px;
  color: rgba(255, 255, 255, 1);
  font-family: agency fb;
  font-size: 20pt;
  /*display: inline-block;*/
}

#fcor {
  color: rgba(255, 220, 180, 1);
}

.galeria {
  display: flex;
  justify-content: center;
}
.galeria a figure{
  position: relative;
  margin: 10px;
  padding: 0px;
  width: 200px;
  height: 200px;
  background-color: white;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, .4);
  text-align: center;
}
.galeria a figure img{
  width: 200px;
  height: 200px;
}

.legenda {
  position: absolute;
  right: 0;
  left: 0;
  bottom: 10px;
  margin: auto;
}


/*Postagens*/

#postagem02 {
  background-color: white;
  background: url("../_imagens/win10.jpg") no-repeat;
  background-size: 200px 200px;
}

#postagem03 {
  background-color: white;
  background: url("../_imagens/oracle.png") no-repeat;
  background-size: 200px 200px;
}

#postagem05 {
  background-color: white;
  background: url("../_imagens/vnc.png") no-repeat;
  background-size: 200px 200px;
}

#postagem04 {
  background-color: white;
  background: url("../_imagens/office.jpg") no-repeat;
  background-size: 200px 200px;
}
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><bodyclass="postagem">
	<header class="cabecalho">
		<h1 class="logo">MANUAIS E PROCESSOS<span id="fcor"> INFORMÁTICA</span>
					</h1>
	</header>
  
	<div id="interface">
		<section class="galeria">
			<a href="_postagem/1009182.html">
				<figure>
					<img class="imgp" src="https://image.ibb.co/cXVJ79/check.jpg"><figcaptionclass="legenda">Legenda Checklist</figcaption>
				</figure>
			</a>
			<a href="_postagem/1009182.html">
				<figure>
					<img class="imgp" src="https://image.ibb.co/gabEfU/win10.jpg"><figcaptionclass="legenda">Legenda Windows 10</figcaption>
				</figure>
			</a>
			<a href="_postagem/1009182.html">
				<figure><img class="imgp" src="https://image.ibb.co/eiiGup/oracle.png"><figcaptionclass="legenda">Legenda Oracle</figcaption>
				</figure>
			</a>
			<a href="_postagem/1009182.html">
				<figure>
					<img class="imgp" src="https://image.ibb.co/deNLLU/office.png"><figcaptionclass="legenda">Legenda Office</figcaption>
				</figure>
			</a>
			<a href="_postagem/1009182.html">
				<figure>
					<img class="imgp" src="https://image.ibb.co/cRLwup/vnc.png"><figcaptionclass="legenda">Legenda VNC</figcaption>
				</figure>
			</a>

		</section>
	</div>
    
13.09.2018 / 17:19