Set the width of an element using another element

893 Views Asked by At

this code is simplified, but I need to set the width of the divs "wrap-description" to be the width of the imgs "picture-damage"+20 , of course it will be many elements "picture-damage" and "wrap-description" and their sizes will be different. I have try to use directives and ngStyle, but I have not success, what should I do?

Thank you.

 <ul >
             <li ng-repeat="damagepic in damagesPicture">
                <div>
                    <div>
                        <div>
                                <img ng-class="picture-damage"/>
                                <div ng-class="wrap-description"/>  
                        </div>
                    </div>
                </div>
             </li>
</ul>
1

There are 1 best solutions below

0
On

You can do this:

CSS

img.picture-damage {
    margin-right: 20px;
    float: left;
}

div.wrap-description {
    width: 100%;
    float: left;
}