vue-horizontal icon indicating copy to clipboard operation
vue-horizontal copied to clipboard

Centering items when all items are in view.

Open chillikid opened this issue 4 years ago • 2 comments

Thanks for the great script.

What I want to do is center the items on screen when all items are visible on screen. As a default they always start on the right . I tried .v-hl-container { justify-content: center; }

This works when all items on screen are visible, but then when all items cannot fit on screen it causes a problem in that elements expand both to the left and right out of the viewport and the initial view position is the center of the row.

Is there a simple CSS way to achieve this ? It would seem like a common user case.

Thanks

chillikid avatar Feb 26 '21 14:02 chillikid

After an awful lot of messing about and trying different things, I got it to center on the screen when there are less items than the full width of the viewport by doing the following

<style> .v-hl-container { margin: 0 auto -30px !important; width: auto !important; } </style>

It would be nice if this could be an option in the CSS core as I'm not a fan of using !important to force override styles.

chillikid avatar Mar 02 '21 16:03 chillikid

thanks @chillikid, I'd prefer

.v-hl-container {
    width: auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

mahammad-sixberries avatar Oct 20 '21 10:10 mahammad-sixberries