A
A
Arx7772015-11-11 11:52:21
css
Arx777, 2015-11-11 11:52:21

How to enlarge div on hover while maintaining font size?

There is such html

<div class='general_block'>
    <a class='link' href='#'>
        <img class='img' scr='/img/pic1.jpg'><!--картинка товара-->
        <span class='description_good'>
            описание товара
        </span>
        <span class='cost'>
            цена
        </span>
    </a>
</div>

Now I do this. The picture increases, but the description and price also increase, and this does not look beautiful.
<style type="text/css">
        .general_block:hover{
           position:relative;
            transform: scale(1.5, 1.5);
            margin-top: 35px;
            margin-bottom: -20px;
        }
</style>

fdff8bee51cb49deb7b8f4999ca0fe1a.png
Information about the goods goes in 2 lines of 8 items each. If there was 1 line, then you could simply enlarge the picture. But in my case, when hovering over a product in the first line,
I tried to do it with hover on the image itself
.img:hover{
            margin-top: 25px;
            transform: scale(1.5, 1.5);
            padding-bottom: 17px;
        }

then it shifts the bottom block
4b43bf037c484954b8d3f2e222daf273.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Denis, 2015-11-11
@Arx777

It's not entirely clear what you want to achieve. You don't like it when the bottom block moves, but you also don't like the overlap of the bottom block.
Describe how it should be in your opinion)

A
Alexander Pupkin, 2015-11-11
@sakrab

The img tag doesn't have a closing tag!
In general, it is better to explain to the person to whom you are making a website that it is better to open a whole page with this product by clicking on the picture. This is good for SEO. I don't know how it's called.

M
mr_dev1l, 2015-11-11
@mr_dev1l

Enlarge then not the whole block, but only the picture

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question