1
Well I have a div with the following class c-txt
, note that when the text does not fit inside it, the text is summarized with three points (...).
I need to do this with the div txt
to avoid breaking the buttons.
Someone knows how to do it?
I tried to do so:
.container-footer .txt {
float: left;
margin-top: 15px;
display: inline-block;
white-space: nowrap;
overflow: hidden !important;
text-overflow: ellipsis;
}
But the 3 points do not appear. Follow my code.
An alternative could be to use jQuery?
.container {
left: 0;
right: 0;
margin: 10px auto 10px auto;
width: 95%;
border-radius: 4px;
background: #FFFFFF;
}
.container table {
width: 100%;
margin: 0 auto;
}
.container .linha {
border-top: 1px solid #D7D7D7;
}
.container-head {
width: 100%;
color: #FFFFFF;
border-radius: 4px 4px 0 0;
height: 65px;
background: #000;
line-height: 65px;
display: flex;
}
.container-head .c-ico {
width: 5%;
min-width: 60px;
}
.container-head .c-ico .material-icons {
padding: 20px;
}
.container-head .c-txt {
width: 75%;
display: inline-block;
white-space: nowrap;
overflow: hidden !important;
text-overflow: ellipsis;
}
.container-head .c-bt {
width: 20%;
min-width: 140px;
}
.container-head .c-bt button {
margin-top: 12px;
margin-right: 20px;
border: 0;
width: 100px;
height: 42px;
cursor: pointer;
border-radius: 4px;
color: #FFFFFF;
float: right;
}
.container-head .c-menu {
width: 20%;
min-width: 100px;
}
.container-head .c-menu .overflow-menu {
z-index: 1;
margin-top: 20px;
max-width: 24px;
float: right;
margin-right: 40px;
}
.container-head .c-menu .overflow-menu ul {
margin-top: -5px;
}
.container-body {
padding: 20px;
}
.container-body .notification {
margin-left: -20px;
margin-right: -20px;
}
.container-body .row {
margin-left: 0px;
margin-right: 0px;
}
.container-body .tab-content {
margin-left: -15px;
margin-right: -15px;
}
.container-body .tabs {
margin-left: -20px;
margin-right: -20px;
}
.container-body-scroll {
overflow: auto;
height: 319px;
text-align: left;
}
.container-footer {
border-top: 1px solid #D7D7D7;
height: 50px;
padding-left: 10px;
padding-right: 10px;
}
.container-footer button {
margin-top: 7px;
border: 0;
height: 35px;
min-width: 36px;
cursor: pointer;
border-radius: 4px;
color: #FFFFFF;
float: right;
}
.container-footer .txt {
float: left;
margin-top: 15px;
}
/* Mobile */
@media only screen and (max-width: 900px) {
.container.w50 {
width: 80%;
}
}
@media only screen and (max-width: 600px) {
.container.w50 {
width: 95%;
}
}
<!-- Container Button -->
<div class="container">
<!-- Container Head -->
<div class="container-head">
<div class="c-ico"></div>
<div class="c-txt">TÍTULO CONTAINER BUTTON orem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum gravida et elit et mattis. </div>
<div class="c-bt">
<button type='submit'>FINALIZAR</button>
</div>
</div>
<!-- Container Footer -->
<div class="container-footer">
<div class="txt">
TEXTO 1 orem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum gravida et elit et mattis. orem ipsum dolor sit.
</div>
<button type='button'>OK</button>
</div>
<div class="container-footer">
<div class="txt">
TEXTO 1
</div>
<button type='button' class="bg-green-2-houve">OK</button>
</div>
<div class="container-footer">
<div class="txt">
TEXTO 1
</div>
<button type='button' class="bg-red-2-houve">OK</button>
</div>
<div class="container-footer">
<div class="txt">
TEXTO 1
</div>
<button type='button' class="bg-blue-2-houve">OK</button>
</div>
<div class="container-footer">
<div class="txt">
TEXTO 1
</div>
<button type='button' class="bg-yellow-2-houve">OK</button>
</div>
</div>
@Guilhermenascimento this possible duplicate does not address the root of the problem. The author of the question already makes use of text-overflow: Ellipsis; The solution, is to emphasize the use of white-space: nowrap; together, what in no post this was said.
– user60252
@Leocaracciolo both responses show the use of
white-space: nowrap;
, if it is to emphasize every detail that people forget would have to reopen about 10,000 closed questions and just for the record the question has not been closed, maybe it is not dup even, so it is written "possible duplicate".– Guilherme Nascimento
@Guilhermenascimento, without this white-space: nowrap; the text-overflow: Ellipsis does not work at all, this detail, I believe, could never be forgotten! I will even stress this in my reply
– user60252