Vuetify and Layout grid system: limiting vertically an element
The problem is simple.
I'd like to have a way to limit vertically an element, specifically a v-card, so that the whole layout remains within the size of the screen available, even if the v-card contains a lot of text, adding to the v-card a scrollbar, if needed. This without giving to any element a specific fixed height in pixels.
I will add two examples, which I made changing a bit one of the examples from the official page.
Like you'll see, everything works as intended, but if the v-card text has too much text, it, instead of gaining a scrollbar, either expands over the borders of its container, if it has the "position: absolute" as in this example https://codepen.io/anon/pen/xmvXpX?editors=1010; or forces its container and its "brothers" and the whole layout to expand over the limit of the available screen, if the "position: absolute" is removed, as in this example https://codepen.io/anon/pen/yGmPxK?editors=1010.
So I wonder if there is a way to achieve the desired result, while retaining the ability for the layout to expand to fill completely the screen smoothly, hence without using anywhere the obvious "height: Hpx" solution.
Practically I need something like the opposite of the "fit-content" to use in the v-card, something like "dont-care-about-content-and-keep-the-damn-height-you-had-at-the-start".
Here the version of the code using the "position:absolute"
<div id="app">
<v-app id="inspire">
<v-container fluid grid-list-sm d-flex style="height:100%">
<v-layout row wrap>
<v-flex d-flex xs12 order-xs5>
<v-layout column>
<v-flex d-flex>
<v-card color="blue-grey" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-card color="brown" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm7>
<v-layout row wrap>
<v-flex d-flex>
<v-card color="indigo lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 70) }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-layout row>
<v-flex
v-for="n in 2"
:key="n"
d-flex
>
<v-card
color="amber lighten-2"
tile
flat
>
<v-card-text>{{ lorem.slice(0, 40) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm2 child-flex>
<v-card color="orange lighten-2" tile flat>
<v-card-text style="overflow: auto; position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex xs12 sm3>
<v-card color="red lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 100) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-app>
</div>
And the JS
new Vue({
el: '#app',
data: () => ({
lorem: `Lorem ipsum dolor sit amet, mel at clita quando. Te sit oratio vituperatoribus, nam ad ipsum posidonium mediocritatem, explicari dissentiunt cu mea. Repudiare disputationi vim in, mollis iriure nec cu, alienum argumentum ius ad. Pri eu justo aeque torquatos.`
})
})
html css vuetify.js
add a comment |
The problem is simple.
I'd like to have a way to limit vertically an element, specifically a v-card, so that the whole layout remains within the size of the screen available, even if the v-card contains a lot of text, adding to the v-card a scrollbar, if needed. This without giving to any element a specific fixed height in pixels.
I will add two examples, which I made changing a bit one of the examples from the official page.
Like you'll see, everything works as intended, but if the v-card text has too much text, it, instead of gaining a scrollbar, either expands over the borders of its container, if it has the "position: absolute" as in this example https://codepen.io/anon/pen/xmvXpX?editors=1010; or forces its container and its "brothers" and the whole layout to expand over the limit of the available screen, if the "position: absolute" is removed, as in this example https://codepen.io/anon/pen/yGmPxK?editors=1010.
So I wonder if there is a way to achieve the desired result, while retaining the ability for the layout to expand to fill completely the screen smoothly, hence without using anywhere the obvious "height: Hpx" solution.
Practically I need something like the opposite of the "fit-content" to use in the v-card, something like "dont-care-about-content-and-keep-the-damn-height-you-had-at-the-start".
Here the version of the code using the "position:absolute"
<div id="app">
<v-app id="inspire">
<v-container fluid grid-list-sm d-flex style="height:100%">
<v-layout row wrap>
<v-flex d-flex xs12 order-xs5>
<v-layout column>
<v-flex d-flex>
<v-card color="blue-grey" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-card color="brown" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm7>
<v-layout row wrap>
<v-flex d-flex>
<v-card color="indigo lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 70) }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-layout row>
<v-flex
v-for="n in 2"
:key="n"
d-flex
>
<v-card
color="amber lighten-2"
tile
flat
>
<v-card-text>{{ lorem.slice(0, 40) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm2 child-flex>
<v-card color="orange lighten-2" tile flat>
<v-card-text style="overflow: auto; position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex xs12 sm3>
<v-card color="red lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 100) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-app>
</div>
And the JS
new Vue({
el: '#app',
data: () => ({
lorem: `Lorem ipsum dolor sit amet, mel at clita quando. Te sit oratio vituperatoribus, nam ad ipsum posidonium mediocritatem, explicari dissentiunt cu mea. Repudiare disputationi vim in, mollis iriure nec cu, alienum argumentum ius ad. Pri eu justo aeque torquatos.`
})
})
html css vuetify.js
add a comment |
The problem is simple.
I'd like to have a way to limit vertically an element, specifically a v-card, so that the whole layout remains within the size of the screen available, even if the v-card contains a lot of text, adding to the v-card a scrollbar, if needed. This without giving to any element a specific fixed height in pixels.
I will add two examples, which I made changing a bit one of the examples from the official page.
Like you'll see, everything works as intended, but if the v-card text has too much text, it, instead of gaining a scrollbar, either expands over the borders of its container, if it has the "position: absolute" as in this example https://codepen.io/anon/pen/xmvXpX?editors=1010; or forces its container and its "brothers" and the whole layout to expand over the limit of the available screen, if the "position: absolute" is removed, as in this example https://codepen.io/anon/pen/yGmPxK?editors=1010.
So I wonder if there is a way to achieve the desired result, while retaining the ability for the layout to expand to fill completely the screen smoothly, hence without using anywhere the obvious "height: Hpx" solution.
Practically I need something like the opposite of the "fit-content" to use in the v-card, something like "dont-care-about-content-and-keep-the-damn-height-you-had-at-the-start".
Here the version of the code using the "position:absolute"
<div id="app">
<v-app id="inspire">
<v-container fluid grid-list-sm d-flex style="height:100%">
<v-layout row wrap>
<v-flex d-flex xs12 order-xs5>
<v-layout column>
<v-flex d-flex>
<v-card color="blue-grey" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-card color="brown" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm7>
<v-layout row wrap>
<v-flex d-flex>
<v-card color="indigo lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 70) }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-layout row>
<v-flex
v-for="n in 2"
:key="n"
d-flex
>
<v-card
color="amber lighten-2"
tile
flat
>
<v-card-text>{{ lorem.slice(0, 40) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm2 child-flex>
<v-card color="orange lighten-2" tile flat>
<v-card-text style="overflow: auto; position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex xs12 sm3>
<v-card color="red lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 100) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-app>
</div>
And the JS
new Vue({
el: '#app',
data: () => ({
lorem: `Lorem ipsum dolor sit amet, mel at clita quando. Te sit oratio vituperatoribus, nam ad ipsum posidonium mediocritatem, explicari dissentiunt cu mea. Repudiare disputationi vim in, mollis iriure nec cu, alienum argumentum ius ad. Pri eu justo aeque torquatos.`
})
})
html css vuetify.js
The problem is simple.
I'd like to have a way to limit vertically an element, specifically a v-card, so that the whole layout remains within the size of the screen available, even if the v-card contains a lot of text, adding to the v-card a scrollbar, if needed. This without giving to any element a specific fixed height in pixels.
I will add two examples, which I made changing a bit one of the examples from the official page.
Like you'll see, everything works as intended, but if the v-card text has too much text, it, instead of gaining a scrollbar, either expands over the borders of its container, if it has the "position: absolute" as in this example https://codepen.io/anon/pen/xmvXpX?editors=1010; or forces its container and its "brothers" and the whole layout to expand over the limit of the available screen, if the "position: absolute" is removed, as in this example https://codepen.io/anon/pen/yGmPxK?editors=1010.
So I wonder if there is a way to achieve the desired result, while retaining the ability for the layout to expand to fill completely the screen smoothly, hence without using anywhere the obvious "height: Hpx" solution.
Practically I need something like the opposite of the "fit-content" to use in the v-card, something like "dont-care-about-content-and-keep-the-damn-height-you-had-at-the-start".
Here the version of the code using the "position:absolute"
<div id="app">
<v-app id="inspire">
<v-container fluid grid-list-sm d-flex style="height:100%">
<v-layout row wrap>
<v-flex d-flex xs12 order-xs5>
<v-layout column>
<v-flex d-flex>
<v-card color="blue-grey" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-card color="brown" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm7>
<v-layout row wrap>
<v-flex d-flex>
<v-card color="indigo lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 70) }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-layout row>
<v-flex
v-for="n in 2"
:key="n"
d-flex
>
<v-card
color="amber lighten-2"
tile
flat
>
<v-card-text>{{ lorem.slice(0, 40) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm2 child-flex>
<v-card color="orange lighten-2" tile flat>
<v-card-text style="overflow: auto; position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex xs12 sm3>
<v-card color="red lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 100) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-app>
</div>
And the JS
new Vue({
el: '#app',
data: () => ({
lorem: `Lorem ipsum dolor sit amet, mel at clita quando. Te sit oratio vituperatoribus, nam ad ipsum posidonium mediocritatem, explicari dissentiunt cu mea. Repudiare disputationi vim in, mollis iriure nec cu, alienum argumentum ius ad. Pri eu justo aeque torquatos.`
})
})
html css vuetify.js
html css vuetify.js
asked Jan 19 at 21:11
DrHellDrHell
848
848
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Ok, after some fiddling and some more research, here is a general solution (which works for normal divs too).
The div containing the text (v-card-text, in the above example) must have "position: absolute;", the parent div (v-card, in the above example) must have "position: relative; overflow-y: auto;"
This solution, as said above, works quite generally, even if in some cases (when everything is within v-tabs, for example) it still fails, for reason still not clear.
Here is the codepen with the layout working as intended.
https://codepen.io/anon/pen/gZVqBE?editors=1010
These are the lines interested:
...
<v-card color="orange lighten-2;" style=" position: relative; overflow-y: auto;" tile flat>
<v-card-text style="position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
...
And this is the whole code in the codepen
<div id="app">
<v-app id="inspire">
<v-container fluid grid-list-sm d-flex style="height:100%">
<v-layout row wrap>
<v-flex d-flex xs12 order-xs5>
<v-layout column>
<v-flex d-flex>
<v-card color="blue-grey" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-card color="brown" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm7>
<v-layout row wrap>
<v-flex d-flex>
<v-card color="indigo lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 70) }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-layout row>
<v-flex
v-for="n in 2"
:key="n"
d-flex
>
<v-card
color="amber lighten-2"
tile
flat
>
<v-card-text>{{ lorem.slice(0, 40) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm2 child-flex>
<v-card color="orange lighten-2;" style=" position: relative; overflow-y: auto;" tile flat>
<v-card-text style="position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex xs12 sm3>
<v-card color="red lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 100) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-app>
</div>
add a comment |
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%2f54271423%2fvuetify-and-layout-grid-system-limiting-vertically-an-element%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Ok, after some fiddling and some more research, here is a general solution (which works for normal divs too).
The div containing the text (v-card-text, in the above example) must have "position: absolute;", the parent div (v-card, in the above example) must have "position: relative; overflow-y: auto;"
This solution, as said above, works quite generally, even if in some cases (when everything is within v-tabs, for example) it still fails, for reason still not clear.
Here is the codepen with the layout working as intended.
https://codepen.io/anon/pen/gZVqBE?editors=1010
These are the lines interested:
...
<v-card color="orange lighten-2;" style=" position: relative; overflow-y: auto;" tile flat>
<v-card-text style="position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
...
And this is the whole code in the codepen
<div id="app">
<v-app id="inspire">
<v-container fluid grid-list-sm d-flex style="height:100%">
<v-layout row wrap>
<v-flex d-flex xs12 order-xs5>
<v-layout column>
<v-flex d-flex>
<v-card color="blue-grey" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-card color="brown" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm7>
<v-layout row wrap>
<v-flex d-flex>
<v-card color="indigo lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 70) }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-layout row>
<v-flex
v-for="n in 2"
:key="n"
d-flex
>
<v-card
color="amber lighten-2"
tile
flat
>
<v-card-text>{{ lorem.slice(0, 40) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm2 child-flex>
<v-card color="orange lighten-2;" style=" position: relative; overflow-y: auto;" tile flat>
<v-card-text style="position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex xs12 sm3>
<v-card color="red lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 100) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-app>
</div>
add a comment |
Ok, after some fiddling and some more research, here is a general solution (which works for normal divs too).
The div containing the text (v-card-text, in the above example) must have "position: absolute;", the parent div (v-card, in the above example) must have "position: relative; overflow-y: auto;"
This solution, as said above, works quite generally, even if in some cases (when everything is within v-tabs, for example) it still fails, for reason still not clear.
Here is the codepen with the layout working as intended.
https://codepen.io/anon/pen/gZVqBE?editors=1010
These are the lines interested:
...
<v-card color="orange lighten-2;" style=" position: relative; overflow-y: auto;" tile flat>
<v-card-text style="position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
...
And this is the whole code in the codepen
<div id="app">
<v-app id="inspire">
<v-container fluid grid-list-sm d-flex style="height:100%">
<v-layout row wrap>
<v-flex d-flex xs12 order-xs5>
<v-layout column>
<v-flex d-flex>
<v-card color="blue-grey" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-card color="brown" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm7>
<v-layout row wrap>
<v-flex d-flex>
<v-card color="indigo lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 70) }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-layout row>
<v-flex
v-for="n in 2"
:key="n"
d-flex
>
<v-card
color="amber lighten-2"
tile
flat
>
<v-card-text>{{ lorem.slice(0, 40) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm2 child-flex>
<v-card color="orange lighten-2;" style=" position: relative; overflow-y: auto;" tile flat>
<v-card-text style="position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex xs12 sm3>
<v-card color="red lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 100) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-app>
</div>
add a comment |
Ok, after some fiddling and some more research, here is a general solution (which works for normal divs too).
The div containing the text (v-card-text, in the above example) must have "position: absolute;", the parent div (v-card, in the above example) must have "position: relative; overflow-y: auto;"
This solution, as said above, works quite generally, even if in some cases (when everything is within v-tabs, for example) it still fails, for reason still not clear.
Here is the codepen with the layout working as intended.
https://codepen.io/anon/pen/gZVqBE?editors=1010
These are the lines interested:
...
<v-card color="orange lighten-2;" style=" position: relative; overflow-y: auto;" tile flat>
<v-card-text style="position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
...
And this is the whole code in the codepen
<div id="app">
<v-app id="inspire">
<v-container fluid grid-list-sm d-flex style="height:100%">
<v-layout row wrap>
<v-flex d-flex xs12 order-xs5>
<v-layout column>
<v-flex d-flex>
<v-card color="blue-grey" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-card color="brown" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm7>
<v-layout row wrap>
<v-flex d-flex>
<v-card color="indigo lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 70) }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-layout row>
<v-flex
v-for="n in 2"
:key="n"
d-flex
>
<v-card
color="amber lighten-2"
tile
flat
>
<v-card-text>{{ lorem.slice(0, 40) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm2 child-flex>
<v-card color="orange lighten-2;" style=" position: relative; overflow-y: auto;" tile flat>
<v-card-text style="position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex xs12 sm3>
<v-card color="red lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 100) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-app>
</div>
Ok, after some fiddling and some more research, here is a general solution (which works for normal divs too).
The div containing the text (v-card-text, in the above example) must have "position: absolute;", the parent div (v-card, in the above example) must have "position: relative; overflow-y: auto;"
This solution, as said above, works quite generally, even if in some cases (when everything is within v-tabs, for example) it still fails, for reason still not clear.
Here is the codepen with the layout working as intended.
https://codepen.io/anon/pen/gZVqBE?editors=1010
These are the lines interested:
...
<v-card color="orange lighten-2;" style=" position: relative; overflow-y: auto;" tile flat>
<v-card-text style="position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
...
And this is the whole code in the codepen
<div id="app">
<v-app id="inspire">
<v-container fluid grid-list-sm d-flex style="height:100%">
<v-layout row wrap>
<v-flex d-flex xs12 order-xs5>
<v-layout column>
<v-flex d-flex>
<v-card color="blue-grey" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-card color="brown" dark tile flat>
<v-card-text>{{ lorem }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm7>
<v-layout row wrap>
<v-flex d-flex>
<v-card color="indigo lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 70) }}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex>
<v-layout row>
<v-flex
v-for="n in 2"
:key="n"
d-flex
>
<v-card
color="amber lighten-2"
tile
flat
>
<v-card-text>{{ lorem.slice(0, 40) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
<v-flex d-flex xs12 sm2 child-flex>
<v-card color="orange lighten-2;" style=" position: relative; overflow-y: auto;" tile flat>
<v-card-text style="position: absolute">{{ lorem.slice(0, 90) }} {{lorem}} {{lorem}} {{lorem}} {{lorem}} {{lorem}}</v-card-text>
</v-card>
</v-flex>
<v-flex d-flex xs12 sm3>
<v-card color="red lighten-2" dark tile flat>
<v-card-text>{{ lorem.slice(0, 100) }}</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-app>
</div>
answered Jan 20 at 13:29
DrHellDrHell
848
848
add a comment |
add a comment |
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%2f54271423%2fvuetify-and-layout-grid-system-limiting-vertically-an-element%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