【问题标题】:Adjust height of 2 elements in a div调整div中2个元素的高度
【发布时间】:2017-11-13 02:54:11
【问题描述】:

我在一个 div 中有一个段落和一个图像,我正在尝试调整图像的上边距,使其在页面上稍微高一点,而不是图像的顶部与段落的顶部对齐


    #aboutmetext{
    font-family:avenir,calibri;
    font-size:30px;
    color:white;
    text-shadow:2px 2px 5px black;
    width:45%;
    float:left;
    margin-left:5%;
    margin-top:0%;
    }

    #picture{
    float:right;
    margin-right: 10%;
}
    <div>
	   <p id="aboutmetext"><b>I am a visual effects & motion graphics 
    artist with a Bachelor of Science degree from The Art Institute of 
    Pittsburgh. My focus is in motion graphics and graphic design.</b></p>
	<img src="http://moroccodunes.com/img/tours/14290060392.jpg" id="picture" class="bigEntrance" width="500px" 
    border="5" style="border-color:white;padding:5px">
    </div>

    

【问题讨论】:

    标签: html css margin


    【解决方案1】:

    你可以给image a negative margin试试这个

    #aboutmetext{
        font-family:avenir,calibri;
        font-size:30px;
        color:white;
        text-shadow:2px 2px 5px black;
        width:45%;
        float:left;
        margin-left:5%;
        margin-top:0%;
        }
    
        #picture{
        float:right;
        width:45%;
        margin-top:-50px;/* define the negative margin to your need */
    }
    <h1>This is the title</h1>
    <div>
    	   <p id="aboutmetext"><b>I am a visual effects & motion graphics 
        artist with a Bachelor of Science degree from The Art Institute of 
        Pittsburgh. My focus is in motion graphics and graphic design.</b></p>
    	<img src="http://moroccodunes.com/img/tours/14290060392.jpg" id="picture" class="bigEntrance"
        border="5px" style="border-color:white;padding:5px">
        </div>

    【讨论】:

      猜你喜欢
      • 2017-08-16
      • 1970-01-01
      • 2023-03-09
      • 2015-11-17
      • 1970-01-01
      • 1970-01-01
      • 2013-10-01
      • 1970-01-01
      • 2014-03-08
      相关资源
      最近更新 更多