调整div中2个元素的高度

时间:2017-11-12 17:21:50

标签: html css margin

我在一个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>

    

enter image description here

1 个答案:

答案 0 :(得分:0)

你可以试试image a negative margin

&#13;
&#13;
#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 */
}
&#13;
<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>
&#13;
&#13;
&#13;