Is there a css-grid property which locks max dimensions of grid children to be no bigger than their parent?
![Multi tool use Multi tool use](http://sgv.ssvwv.com/sg/ssvwvcomimagb.png)
Multi tool use
Is there a css-grid property which locks the grid children to be no bigger than their parent?
I've been using css-grid to create layouts for some time now and one common problem I've been seeing is that the contents of a grid child overflowing their parent container.
When searching the solution to this problem, most of the time, the solution suggested is to set the property of the grid child item to be something like: max-height: 100%, max-width: 100% or overflow:hidden on the child item. But IMO this is not the best way to solve the problem. While building interactive pages where a user might be uploading contents, we might not be able to control the size of content in grid child, instead there should be an option to set in the parent grid, that no matter what, the child grid will not exceed the size initially set or the size of the parent grid. Indeed, one can override this default to their liking if they wanted the child grid item to be able to overflow.
So is there a css-grid or any other css property that I can set while building a grid, so that any of the children are guaranteed to not exceed the size of the parent?
css css-grid
add a comment |
Is there a css-grid property which locks the grid children to be no bigger than their parent?
I've been using css-grid to create layouts for some time now and one common problem I've been seeing is that the contents of a grid child overflowing their parent container.
When searching the solution to this problem, most of the time, the solution suggested is to set the property of the grid child item to be something like: max-height: 100%, max-width: 100% or overflow:hidden on the child item. But IMO this is not the best way to solve the problem. While building interactive pages where a user might be uploading contents, we might not be able to control the size of content in grid child, instead there should be an option to set in the parent grid, that no matter what, the child grid will not exceed the size initially set or the size of the parent grid. Indeed, one can override this default to their liking if they wanted the child grid item to be able to overflow.
So is there a css-grid or any other css property that I can set while building a grid, so that any of the children are guaranteed to not exceed the size of the parent?
css css-grid
stackoverflow.com/q/43311943/3597276
– Michael_B
Dec 29 '18 at 21:16
Thanks Michael, reading: stackoverflow.com/questions/36247140/… Looks like I still would need to either set min-width & min-height to 0 on child or set overflow: hidden on child. While this does answer on how to keep child contents from overflowing, is there a way to set this on the parent and rest knowing no child items can breach that parent limit?
– P. Jim
Dec 30 '18 at 0:25
Thanks @Michael_B
– P. Jim
Dec 31 '18 at 19:18
add a comment |
Is there a css-grid property which locks the grid children to be no bigger than their parent?
I've been using css-grid to create layouts for some time now and one common problem I've been seeing is that the contents of a grid child overflowing their parent container.
When searching the solution to this problem, most of the time, the solution suggested is to set the property of the grid child item to be something like: max-height: 100%, max-width: 100% or overflow:hidden on the child item. But IMO this is not the best way to solve the problem. While building interactive pages where a user might be uploading contents, we might not be able to control the size of content in grid child, instead there should be an option to set in the parent grid, that no matter what, the child grid will not exceed the size initially set or the size of the parent grid. Indeed, one can override this default to their liking if they wanted the child grid item to be able to overflow.
So is there a css-grid or any other css property that I can set while building a grid, so that any of the children are guaranteed to not exceed the size of the parent?
css css-grid
Is there a css-grid property which locks the grid children to be no bigger than their parent?
I've been using css-grid to create layouts for some time now and one common problem I've been seeing is that the contents of a grid child overflowing their parent container.
When searching the solution to this problem, most of the time, the solution suggested is to set the property of the grid child item to be something like: max-height: 100%, max-width: 100% or overflow:hidden on the child item. But IMO this is not the best way to solve the problem. While building interactive pages where a user might be uploading contents, we might not be able to control the size of content in grid child, instead there should be an option to set in the parent grid, that no matter what, the child grid will not exceed the size initially set or the size of the parent grid. Indeed, one can override this default to their liking if they wanted the child grid item to be able to overflow.
So is there a css-grid or any other css property that I can set while building a grid, so that any of the children are guaranteed to not exceed the size of the parent?
css css-grid
css css-grid
asked Dec 29 '18 at 21:11
P. JimP. Jim
1
1
stackoverflow.com/q/43311943/3597276
– Michael_B
Dec 29 '18 at 21:16
Thanks Michael, reading: stackoverflow.com/questions/36247140/… Looks like I still would need to either set min-width & min-height to 0 on child or set overflow: hidden on child. While this does answer on how to keep child contents from overflowing, is there a way to set this on the parent and rest knowing no child items can breach that parent limit?
– P. Jim
Dec 30 '18 at 0:25
Thanks @Michael_B
– P. Jim
Dec 31 '18 at 19:18
add a comment |
stackoverflow.com/q/43311943/3597276
– Michael_B
Dec 29 '18 at 21:16
Thanks Michael, reading: stackoverflow.com/questions/36247140/… Looks like I still would need to either set min-width & min-height to 0 on child or set overflow: hidden on child. While this does answer on how to keep child contents from overflowing, is there a way to set this on the parent and rest knowing no child items can breach that parent limit?
– P. Jim
Dec 30 '18 at 0:25
Thanks @Michael_B
– P. Jim
Dec 31 '18 at 19:18
stackoverflow.com/q/43311943/3597276
– Michael_B
Dec 29 '18 at 21:16
stackoverflow.com/q/43311943/3597276
– Michael_B
Dec 29 '18 at 21:16
Thanks Michael, reading: stackoverflow.com/questions/36247140/… Looks like I still would need to either set min-width & min-height to 0 on child or set overflow: hidden on child. While this does answer on how to keep child contents from overflowing, is there a way to set this on the parent and rest knowing no child items can breach that parent limit?
– P. Jim
Dec 30 '18 at 0:25
Thanks Michael, reading: stackoverflow.com/questions/36247140/… Looks like I still would need to either set min-width & min-height to 0 on child or set overflow: hidden on child. While this does answer on how to keep child contents from overflowing, is there a way to set this on the parent and rest knowing no child items can breach that parent limit?
– P. Jim
Dec 30 '18 at 0:25
Thanks @Michael_B
– P. Jim
Dec 31 '18 at 19:18
Thanks @Michael_B
– P. Jim
Dec 31 '18 at 19:18
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53973370%2fis-there-a-css-grid-property-which-locks-max-dimensions-of-grid-children-to-be-n%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53973370%2fis-there-a-css-grid-property-which-locks-max-dimensions-of-grid-children-to-be-n%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
u2X1c dQdxEvKwFfpJT10J5D,Rinmo8 BlgB ycd
stackoverflow.com/q/43311943/3597276
– Michael_B
Dec 29 '18 at 21:16
Thanks Michael, reading: stackoverflow.com/questions/36247140/… Looks like I still would need to either set min-width & min-height to 0 on child or set overflow: hidden on child. While this does answer on how to keep child contents from overflowing, is there a way to set this on the parent and rest knowing no child items can breach that parent limit?
– P. Jim
Dec 30 '18 at 0:25
Thanks @Michael_B
– P. Jim
Dec 31 '18 at 19:18