user1922212
user1922212

Reputation: 165

Why is my text wrapping onto a second line?

I'm trying to get my text properly aligned. However, it's not expanding when there's a long caption or description. Below is what I have..

Screenshot: enter image description here

"The Forum" is fine, but "Subscribe Today!" isn't staying on one line like "The Forum." It happens when there's long text. Also, same thing for the description.

HTML:

<div class="hotcampaign-container">
    <a href="' . $item['url'] . '">
        <div id="campaigns_image">
            <img src="' . $item['image_url'] . '" align="left" alt="' . $item['caption'] . '" />
    </a>    </div>
    <div id="campaigns_caption">' . $item['caption'] . '</div>
    <div id="campaigns_desc">' . $item['desc'] . '</div>
    <div id="campaigns_link">
        <a href="' . $item['url'] . '">
            <div align="right">More Info &raquo;</div>
        </a>
        </p>
    </div>
<br />
</div>

Div ID's CSS:

#campaigns_image {
    padding: 0px 10px 10px;
}
#campaigns_caption {
    padding: 0px 177px 0px;
    font-weight: bold;
}
#campaigns_desc {
    padding: 0px 177px 0px;
}
#campaigns_link {
    padding: 0px 10px 0px;
}

Upvotes: 2

Views: 1209

Answers (4)

Praveen
Praveen

Reputation: 56539

Try white-space: nowrap

#campaigns_caption {
    padding: 0px 177px 0px;
    font-weight: bold;
    white-space: nowrap;
}

Upvotes: 0

Arun Bertil
Arun Bertil

Reputation: 4648

Try

#campaigns_caption{
    padding: 0px 177px 0px;
    font-weight: bold;
    width:auto;
    min-width:300px;//some px according to te scenario
}

Upvotes: 1

PaoloCargnin
PaoloCargnin

Reputation: 442

Try to remove the padding right to your css of the #campgaigns_caption div:

#campaigns_caption {
    padding: 0px 0px 0px;
    font-weight: bold;
}

Upvotes: 0

Nitesh
Nitesh

Reputation: 15779

Add a whitespace:nowrap; for the class or id of the <div> that renders "Subscribe today" text.

Upvotes: 0

Related Questions