0

ブラウザーでプレビューすると、それらの間に大きなギャップがある 2 つの div があります。

コード:

<div id="title-1">
        <p>XXX is pleased to announce the launch of our Social Enterprise - Experience Us</p>
    </div>
    <div id="maindescription-1">
        <p>XXX are conducting unique tours to celebrate us, the beating heart of our culture in Scotland.  We will be 
        taking people on a journey through Glasgow, Scotland on a guided tour about the stories of the locals and pioneers that
        made Glasgow what it is today, and then expanding the experiences with tasting tours of the variety of delicious cuisines
        on offer.  Please see below for more information:</p>

CSS:

#title-1 {
    font: normal normal bold 100% "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;
    float: left;
    width: 850px;
    padding: 10px;
    color: #FFFF00;
    text-align: justify;
    vertical-align: baseline;
}
#maindescription-1 {
    font: 100% "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;
    float: left;
    width: 850px;
    padding: 10px;
    color: #FFFFFF;
    text-align: justify;
    vertical-align: baseline;
}

この問題を解決するにはどうすればよいですか?

4

3 に答える 3

0

要素のマージンとパディングを調整するだけです(デフォルトでは、ブラウザごとに異なる方法で適用されます)<p>

例えば

p {
    margin : 1em 0 0 0; // or 0
    padding : 0;
}
于 2012-09-21T12:44:34.893 に答える
0

まず、最後の div を閉じる必要があります

    <div id="title-1">
            <p>XXX is pleased to announce the launch of our Social Enterprise - Experience Us</p>
        </div>
        <div id="maindescription-1">
            <p>XXX are conducting unique tours to celebrate us, the beating heart of our culture in Scotland.  We will be 
            taking people on a journey through Glasgow, Scotland on a guided tour about the stories of the locals and pioneers that
            made Glasgow what it is today, and then expanding the experiences with tasting tours of the variety of delicious cuisines
            on offer.  Please see below for more information:</p>    
</div>

そして、pのマージンを0に設定する必要があります

p 
{
    margin : 0;
}
于 2012-09-21T12:46:53.517 に答える