Margin on child element moves parent element
Date : March 29 2020, 07:55 AM
hope this fix your issue Found an alternative at Child elements with margins within DIVs You can also add: .parent { overflow: auto; }
.parent { overflow: hidden; }
.parent {
padding-top: 1px;
margin-top: -1px;
}
<style type="text/css">
h1, h2, p, ul {
margin-top: 1em;
margin-bottom: 1em;
}
</style>
<h1>Title!</h1>
<div class="text">
<h2>Title!</h2>
<p>Paragraph</p>
</div>
<div class="text">
<h2>Title!</h2>
<p>Paragraph</p>
<ul>
<li>list item</li>
</ul>
</div>
|
How can I override a parent element's padding from a child
Tag : css , By : user106284
Date : March 29 2020, 07:55 AM
this will help if you want the UL to expand out of the container div then you need to set the UL to have an absolute position. Dont forget to set the top and left styles to get the UL to not be up tight against the DIV as position absolute wont obey the containers div padding
|
Jquery UI Sortable - Child element moves parent items
Date : March 29 2020, 07:55 AM
it should still fix some issue I have the following html: , Try: $('.wrapper').sortable({
axis: 'y',
handle: '.box__move'
});
|
<nav> element moves out of parent when having <a> element as a child
Date : March 29 2020, 07:55 AM
|
Child span element getting out of parent element, flexbox / margin - padding issue
Tag : html , By : user94076
Date : March 29 2020, 07:55 AM
Hope this helps For the ellipsis to work when an ancestor is a flex item, all the children of the flex item and the flex item itself need overflow: hidden (or min-width: 0), and the flex item also need flex-shrink: 1 so it is allowed to shrink below its content. Additionally, a flex item's min-width defaults to auto, which as well means it isn't allowed to be smaller than its content, hence the need of overflow: hidden (or min-width: 0). .fixIssue {
align-items: center;
}
.thumbnail {
width: 68px;
height: 68px;
border-radius: 50%;
object-fit: cover;
}
.imgSpan {
border: 1px solid yellow;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: space-around;
}
.textSpanInner {
display: flex;
justify-content: flex-start;
align-items: center;
overflow: hidden;
}
.linkStyle {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
<div style="height: 150px; border: 1px solid red;box-sizing:border-box">
<span class="fixIssue" style="display:flex; justify-content:flex-start;flex-wrap:nowrap;height:100px; border:1px dotted green;">
<span style="flex:0 0 auto; margin-right:10px;">
<span class="imgSpan">
<img src="https://dummyimage.com/68x68/d612e8/" class="thumbnail" />
</span>
</span>
<span style="flex:0 1 auto; margin-right:10px; overflow: hidden">
<span class="textSpanInner">
<a href="" class="linkStyle">Big Name HereBig Name HereBig Name HereBig Name Here</a>
</span>
</span>
</span>
</div>
|