Skip to content Skip to sidebar Skip to footer

Css Fill Remaining Horizontal Space And Show An Ellipsis

I'm trying to create a table-like-display containing 2 columns using div elements. One column is for an image URL while the other is for the file size. The file size column has a f

Solution 1:

I think you are looking for something more like this in the following JSFIDDLE. I have rearranged your CSS to look like the following:

#container {
width: 100%;
}
.imageURL {
    display: inline-block;
    text-overflow: ellipsis;
    overflow: hidden;
    width:auto;
    min-width:100px;
    max-width:65%;
    white-space:nowrap;
}
.fileSize {
    display: inline-block;
    margin-left: 100px;

}
.row {
  overflow: hidden;
   white-space:nowrap;
}

Mainly, I have added the white-space nowrap property along with keeping both divs on the same line, I took out the float, which had made it a block level element, and just placed a margin to be a specific amount from it. The key comes from the width in the .imageURL class, where I added an auto width, a min width, and a max width, which allows the ellipsis to take place at certain points.

Solution 2:

Change .imageURL to the following:

.imageURL {
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 400px;
    display: block;
    overflow: hidden
}

Hope This Helps!;)

JSFiddle Example

Post a Comment for "Css Fill Remaining Horizontal Space And Show An Ellipsis"