How can I size these spans so that the pictures don't extend past them?


Tags: html,css

Problem :

jsFiddle

In this HTML/CSS, I am trying to create some containers which will hold some text, a profile picture (which can have different sizes) and name.

CSS

#fb_status_10150163932662967{
    background:url(http://www.pixel2life.com/twodded/staff/stu/Tutorials/BrickTexture/bricks_zigzag_texture_6190218.JPG) #C0DEED; padding:20px;
}
#fb_status_10150163932662967 p{
    background:#fff;
    padding:10px 12px 10px 12px;
    margin:0;
    min-height:48px;
    color:#000;
    font-size:18px !important;
    line-height:22px;
    -moz-border-radius:5px;
    -webkit-border-radius:5px
}
#fb_status_10150163932662967 p span.metadata{
    display:block;
    width:100%;
    clear:both;
    margin-top:8px;
    padding-top:12px;
    height:40px;
    border-top:1px solid #fff;
    border-top:1px solid #e6e6e6
}
#fb_status_10150163932662967 p span.metadata span.author{
    line-height:19px
}
#fb_status_10150163932662967 p span.metadata span.author img{
    float:left;
    margin:0 7px 0 0px;
}
#fb_status_10150163932662967 p a {
    color: #0084B4;
    text-decoration:none;
}
#fb_status_10150163932662967 p a:hover{
    text-decoration:underline
}
#fb_status_10150163932662967 p span.embedly_timestamp{
    font-size:12px;
    display:block
}

HTML

<div id="fb_status_10150163932662967" class="fb_status">
    <p>
        text1
        <span class="metadata">
            <span class="author">
                <img src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/48898_565722966_3090_t.jpg">
                <strong>
                    Ben
                </strong>
                <br>
            </span>
        </span>
    </p>
    <br>
    <p>
        text2
        <span class="metadata">
            <span class="author">
                <img src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/187486_564261187_2838929_t.jpg">
                <strong>
                    Kirsty
               </strong>
                <br>
            </span>
        </span>
    </p>
    <br>
    <p>
        text3
        <span class="metadata">
            <span class="author">
                <img src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/48898_565722966_3090_t.jpg">
                <strong>
                    Ben
                </strong>
                <br>
            </span>
        </span>
    </p>
</div>

As you can see from the jsFiddle, the profile picture extends past the container. How can I make it so that they are contained fully within the container?



Solution :

@ben; just wirte overflow:hidden in your p tag

check this http://jsfiddle.net/sandeep/Tu5Y5/7/


    CSS Howto..

    How to link a table cell?

    How to center checkbox vertically in a table-cell?

    How do I put hint in a asp:textbox

    How to apply multiple CSS selectors to a paticular div?

    How can I give a child element of one parent a higher z-index than another parent?

    How to apply padding to a column using and CSS in Firefox?

    How to properly fix CSS inconsistencies across desktop and mobile browsers?

    how to use font awesome in own css?

    CSS - How to make different background color from css file used [closed]

    How to get inline-blocks to sit side-by-side?

    CSS delivery optimization: How to defer css loading?

    How to resize a Java Script element to fit its container window

    Background image cut off outside of item. How can I make it show?

    How to use jQuery to find a certain string within a div, and then apply specific styles to another div if it exists? [closed]

    How to add a class to a bar using jQuery?

    CSS - How to center a DIV menu

    How to set jQuery draggable min/max-left and min/max-right

    How can I hide elements on a HTML page until a user hovers over it using CSS?

    How to increase rotate value

    how to avoid the ID name in css file

    only show those div where i do mouse-over

    How to display a button over a picture only when hovering it?

    How to arrange three flex div side by side

    how to align buttons in css/html in one line horizontally?

    How to detect when one or more JS/CSS library fail to load (e.g. CDN)?

    How to correct div overlapping the title

    How to create a multiple-row section with auto-sized columns

    how to really include html codes inside php

    How to identify unused css definitions [closed]

    How to set background gradient css via javascript [duplicate]