如何调整在另一个多的div?div

2023-09-11 07:41:39 作者:╭此女子ヽ请勿伤害

因此​​,这里是我的HTML:

So here's my HTML:

...
<div class="header">
<div class="left">
</div>
<div class="center">
<img class="logo" src="linktomyimage.com/image.png" />
</div>
<div class="right">
</div>
</div>

<!-- And the desired result is: -->
[ [LEFT] [CENTER] [RIGHT] ]

唯一的CSS我已经是:

The only CSS I have is:

* {
margin: 0px;
}
img.logo {
display: block;   margin-left: auto;   margin-right: auto; 
}

我真正需要帮助对准三个div的整个页面上。还div.center必须具有相同的尺寸作为图像,又名宽度 - 800px和高度 - 600px的

I really need help to align the three divs on the whole page. Also div.center must have the same size as the image, aka width - 800px and height - 600px.

推荐答案

它看起来更像比分部表给我...

It looks much more like a table than divisions to me...

<table class="header"><tr>
    <td class="left"></td>
    <td class="center">
        <img class="logo" src="linktomyimage.com/image.png" />
    </td>
    <td class="right"></td>
</tr></table>

想想这样的CSS算账:

Think about so CSS afterwards :

table.header{
    width: 100%;
    border-collapse: collapse;
}

table.header td{
    vertical-align: top;
    border: 1px solid #404040;
}

table.header td.center{
    width: 800px;
    height: 600px;
}

这仅仅是一个code样品,有想法,并适应自己的需要^^

This is just a code sample, get the idea, and adapt to your own needs ^^