首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >内联块垂直定位问题

内联块垂直定位问题
EN

Stack Overflow用户
提问于 2014-03-23 04:28:13
回答 2查看 169关注 0票数 0

嗨,我正在开发一份HTML格式的简历。我遇到了内联块的问题,因为需要使用内联块放在一起的两个div都没有显示预期的结果,其中一个div稍微向下移动。

这似乎是某种定位问题,但我无法弄清楚。div与S盒和L盒风格有关

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=UTF-8/>
<title>HELLO STRICT</title>
<style>
<!--[if lt IE 9]> 
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> 
<![endif]-->


article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section 
{
    display: block;

} 
h1{
    color: #906;
    font-family: "Arial Black", Gadget, sans-serif;
    margin-bottom: 0px;
}
h4{
    margin-bottom: 0px;
    margin-top: o;  

}

<style> 
time 
{ 
font-style: italic; 
} 

li {
    padding-left: 0px;
    text-indent: 0em;
}
div.S-boxes{
    width: 200px;
    height: 150px;
    background-color: #E8E8E8;
    display: inline-block;

    text-align: right;

}

div.L-boxes{

    width: 500px;
    height: 150px;
    background-color: #E8E8E8;
    display: inline-block;

}
p.inbox{

    margin-top:16px;


}

</style> 
</head>
<body>


<h1>Muhammad Qais</h1>
<div>
  <ul style="list-style: none; padding-left: 0px;">
    <li>Village Sooj Bahadar, P.O. Mandra.
    <li>Tehsil Gujarkhan
    <li>District Rawalpindi
    <li>Pakistan
  </ul>
  <table>
        <tr>
             <td>
                     <img src="Telephone-icon-1-.gif" width="27" height="27">
            </td>
            <td>
                : +92-347-9714967
            </td>
    </tr>

            <tr>
                <td>
                <img src="letter_closed.png" width="27" height="27">
                </td>
                <td>
                : muhammadqais32@yahoo.com
                </td>
            </tr>
  </table>

  </div>

<div class="S-boxes">
            <h4>Objective</h4>
    </div>


 <div class="L-boxes">
        <p class="inbox">Seeking  a challenging opportunity where I will be able to utilize my strong organizational  skills, educational background, and ability to work well with people, which  will allow me to grow personally and professionally. I am self-motivated and  able to work both independently and as collaborative team member.</p>
</div>


</body>



</html>
EN

回答 2

Stack Overflow用户

发布于 2014-03-23 05:08:43

display: inline-block;帮助我们在这里渲染两个相邻的灰色方框。很棒,对吧?但是,对于不同的内容,我们需要添加属性vertical-align: top以确保所有内容都与顶部对齐。

代码语言:javascript
复制
div.S-boxes{
    width: 200px;
    height: 150px;
    background-color: #E8E8E8;
    display: inline-block;
  vertical-align:top;
    text-align: right;

}
票数 3
EN

Stack Overflow用户

发布于 2019-08-27 21:53:10

代码语言:javascript
复制
div.S-boxes{
        background-color:#FFF;
        width:20px;
        height:20px;
        display:inline-block;
        border:solid black 1px;
    }

    div.L-boxes{
        background-color:#FFF;
        width:20px;
        height:20px;
        display:inline-block;
        border:solid black 1px;
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22583142

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档