Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have 3 div. One is parent and other are child

HTML
<div class="user-wrap parent">
              <div class="UserText">
                  asdfjlasjdfljasdfljasdlfjasldjfalsdjflasjdflajsdfl;jasdlfjaasdfasd
              </div>
              <div class="DetailsContainer" id="loggedInUserTemplateLogOut" data-ng-click="OnLogoutClicked()">
                  <div class="signouticon"></div>
                  {{ResourceData.SignOut}}
              </div>
          </div>


What I have tried:

The first child div contain text become long then the design is breaking. Please look up on below image.

Error Image

Please help me!
Posted
Updated 11-Nov-21 2:52am

1 solution

CSS
.user-wrap {
	display: flex;
}
.UserText {
	flex: 1 1 auto;
	overflow: hidden;
	text-overflow: ellipsis;
}
.DetailsContainer {
	flex: 0 0 auto;
}
Demo[^]
CSS Flexible Box Layout - CSS: Cascading Style Sheets | MDN[^]
A Complete Guide to Flexbox | CSS-Tricks[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900