如何调整在另一个多的div? [英] How to align multiple divs in another?

查看:174
本文介绍了如何调整在另一个多的div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此​​,这里是我的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 ^^

这篇关于如何调整在另一个多的div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆