0

I have written some HTML code inside PHP with echo as below:

            echo '<a class = "fragment" href = "'.$row['url'].'" target = "_blank" >';
            echo '<div>';
            echo "Title: $title"; echo '<br/>';
            echo "URL:"; echo '<h4>' .$url. '</h4>';
            echo "Preview : $preview"; echo '<br/>';
            echo "Image url: $image"; echo '<br/>';
            echo '</br>';
            echo '</div>';
            echo '</a>';

Problem is $url appears on a new line and in bold text. Though i have not used here <b> or <br/> before and after it.

How can I show it like

URL : www.url.com

same like other parameters appears?

CSS effect appears properly.

css for h4:

.fragment h4 
    {
        padding: 0;
        margin: 0;
        color: #000;
    }

    .fragment h4:hover 
    {
        background-color:#ccc;
        text-decoration: underline; 
    }
4

1 回答 1

6

An h4 tag is (a) a heading tag (hence the boldness) and (b) a block-level tag (hence the new line). If you don't want these aspects, why are you using it?

If you want to style this text, you should use the tag provided for the purpose: <span>. Give it a class or an id and style that.

于 2013-11-05T09:59:16.343 回答