Align text horizontally in relation to the image

4

I'm trying to align the text of some products in relation to the image, but I'm not getting success in what I'm doing, what I have is this:

    <div class="col-md-3 portfolio-item">
     <a href="detalhes.php?prod=<?php echo $row_rsProdutos['id_produto']; ?>" title=""> <img src="<?php echo $imagemThumb; ?>" alt="" /></a>
     <p align="center"><?php echo $row_rsProdutos['nome']; ?></p>
    </div>

I tried to change the reference in my css in the options where values are found for left but the changes did not have any effect, the related css is this:

/*------------------------------------------*/
/*  06 - Estilos Portfolio
/*------------------------------------------*/

.portfolio-filter {
    margin-bottom: 30px;
}

.portfolio-filter li {
    display: inline-block;
    margin-right: 2px;
}

.portfolio-filter li a {
    color: #000;
    display: inline-block;
    padding: 5px 14px;
    border: 1px solid #eee;
    border-radius: 2px;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    -o-border-radius: 2px;
    transition: all 0.3s ease-in-out;
    -moz-transition: all 0.3s ease-in-out;
    -webkit-transition: all 0.3s ease-in-out;
    -o-transition: all 0.3s ease-in-out;
}

.portfolio-filter li a:hover {
    border-color: #ddd;
}

.portfolio-filter li a.selected, .portfolio-filter li a.selected:hover {
    color: #fff;
}

.portfolio-item {
    margin-bottom: 30px;
}

.portfolio-4 {
    margin-left: 5px;
}

.portfolio-4 .portfolio-item {
    width: 24.99%!important;
    padding-left: 10px;
    padding-right: 10px;
    margin-bottom: 22px;
}

.portfolio-item .portfolio-border {
    padding: 3px;
    border: 1px solid #eee;
    border-radius: 3px;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    -o-border-radius: 3px;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
    -moz-transition: all 0.3s ease-in-out;
    -webkit-transition: all 0.3s ease-in-out;
    -o-transition: all 0.3s ease-in-out;
}

.portfolio-item:hover .portfolio-border {
    box-shadow: 0 1px 3px #f8f8f8;
    -o-box-shadow: 0 1px 3px #f8f8f8;
    -moz-box-shadow: 0 1px 3px #f8f8f8;
    -webkit-box-shadow: 0 1px 3px #f8f8f8;
}

.portfolio-item .portfolio-thumb {
    position: relative;
    overflow: hidden;
}

.portfolio-item .portfolio-thumb .thumb-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0);
    transition: all 0.3s ease-in-out;
    -moz-transition: all 0.3s ease-in-out;
    -webkit-transition: all 0.3s ease-in-out;
    -o-transition: all 0.3s ease-in-out;
}

.portfolio-item:hover .portfolio-thumb .thumb-overlay {
    background: rgba(255,255,255,0.5);
}

.portfolio-item .portfolio-thumb .thumb-overlay i {
    color: rgba(255,255,255,0);
    position: absolute;
    top: 42%;
    left: 50%;
    display: block;
    margin-left: -27px;
    margin-top: -19px;
    font-size: 3em;
    transition: all 0.3s ease-in-out;
    -moz-transition: all 0.3s ease-in-out;
    -webkit-transition: all 0.3s ease-in-out;
    -o-transition: all 0.3s ease-in-out;
}

.portfolio-item:hover .portfolio-thumb .thumb-overlay i {
    top: 50%;
    color: #444;
}

.portfolio-item .portfolio-details {
    position: relative;
    padding: 9px 12px 6px 12px;
}

.portfolio-item .portfolio-details .like-link {
    position: absolute;
    right: 8px;
    top: 50%;
    margin-top: -9px;
}

.portfolio-item .portfolio-details .like-link i, .portfolio-item .portfolio-details .like-link span {
    color: #aaa;
    transition: all 0.3s ease-in-out;
    -moz-transition: all 0.3s ease-in-out;
    -webkit-transition: all 0.3s ease-in-out;
    -o-transition: all 0.3s ease-in-out;
}

.portfolio-item .portfolio-details .like-link:hover i, .portfolio-item .portfolio-details .like-link:hover span {
    color: #F54B5C;
}

.portfolio-item .portfolio-details h4 {
    transition: all 0.3s ease-in-out;
    -moz-transition: all 0.3s ease-in-out;
    -webkit-transition: all 0.3s ease-in-out;
    -o-transition: all 0.3s ease-in-out;
}

.portfolio-item .portfolio-details a span {
    color: #000;
}

.portfolio-item .portfolio-details span:after {
    content: ", ";
    margin-right: 2px;
}

.portfolio-item .portfolio-details span:last-child:after {
    content: "";
}

Image of how I'm trying to leave

Page: Products

    
asked by anonymous 29.02.2016 / 15:23

1 answer

2

It's because the image is smaller than the block do this:

.portfolio-item {
    text-align: center;
}

And both the images and the text will be centered, note that it is unnecessary to use align="center" in <p> prefer to use CSS.

    
29.02.2016 / 15:50