Utilizing CSS and Tailwind with either flexbox or grid to showcase repeated information in a layout of three rows

For a school project, I am exploring the use of CSS and Tailwind to enhance my learning. My task involves displaying data using a loop in Vue. The challenge is that this data needs to be presented in rows of 3, 2, and 3 in desktop view, while appearing stacked underneath each other in mobile view. In desktop view, it is essential for all items to be uniform in size and for the second row's items to be centered. I am unsure about the best approach to achieve the layout shown in the image below:

https://i.sstatic.net/xoIrS.png

Answer №1

It's not completely impossible with Tailwind, but given its rapid growth in popularity, who knows what might be achievable in the future.

The overall layout is simple, except for the tricky middle row. To tackle this, I included some additional margins to ensure only 2 items are displayed on that row. This is where your custom CSS skills would come into play, allowing you to target those specific items using the :nth-child() selector.

Check out this CodePen link for reference

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The data-binding in Vue is not updating properly after receiving the response from axios

I need help with a problem. I am trying to create a new item and then update the item list once it is created. However, when I try to set the item list from the server, it does not update in the view. <v-btn @click="create(item)" > </v-b ...

Issues encountered when incorporating personalized CSS into a Vuetify element

Working with the Vuetify selector input component, v-select, and wanting to customize its style led me to inspecting it in Chrome and copying down the necessary classes. For instance, to change the font size of the active value, I utilized: .v-select__sel ...

Differences in React projects utilizing materialize-css compared to those using react-toolbox or material-ui

Is there a difference in technical benefits or code reliability when directly using material-css in JSX versus utilizing JSX specific libraries like material-ui or react-toolbox? Conversely, could using JSX libraries like material-ui or react-toolbox provi ...

Different ways to style this form using only CSS

Consider the HTML code below: <form> <p> <label for="id_name">Name:</label> <input id="id_name" maxlength="40" name="name" type="text"> </p> <p> <label for="id_format">Fo ...

Navigate through the Jquery slider by continuously scrolling to the right or simply clicking

Is there a way to prevent my slider from continuously scrolling? I think it has something to do with the offset parameter but I'm having trouble figuring it out. Any assistance would be greatly appreciated. var $container = $(container); var resizeF ...

Extract information from JSON using a filter

Is there a way to extract the data value from the list without relying on index positions, considering that the order of arrays can change? I need to specifically target data where code === "size". Unfortunately, the existing structure cannot be ...

Adjust the color of the glyphicon icon within a date and time picker dropdown component

I decided to implement the bootstrap datetimepicker using this gem and utilized the following HTML code: <div id="custom-dates" style=" clear:both;"> <div class="container"> <div class="row"> <div class='col-md-3 col-xs-3' ...

Unable to set child element to match parent element's height in Internet Explorer

Attempting to make a child element of a table cell inherit the height and width of the table cell through CSS. Below is the HTML provided: <tr> <td> <div class="yellowDiv"></div> </td> <td></td> ...

Using ASP .NET controls in conjunction with Bootstrap

Is there a way to easily apply bootstrap classes to all asp .net controls in my application at once? Here is an example of how I formatted my menu control using bootstrap. I am looking for a solution where I can apply the bootstrap theme commonly to all m ...

Ensure that the Div element remains visible on the screen while contained within a

Is there a way to maintain the position of elements on the right side of a div without using position: fixed, while still keeping the div within its parent container? See the desired layout. I need the "Stays in view" element to stay within its parent div ...

Issue with datepicker functionality not operational for newly added entries in the table

@Scripts.Render("~/bundles/script/vue") <script> var vueApp = new Vue({ el: '#holiday-vue', data: { holidays: @Html.Raw(Json.Encode(Model)), tableHeader: 'Local Holidays', holidayWarning: true, dateWarning: true }, methods: ...

Energetic flair for Vue animations

I am currently developing a VueJS sidebar component. The objective is to allow the parent to define a width and display a toggle button that smoothly slides the sidebar in and out. Here is an example: <template> <div class="sidebarContainer ...

To prevent DOM errors in Vue-bootstrap and Nuxt.js, it is recommended to utilize the <b-dropdown> element within the <b-collapse> component

Here is the code I have for my navigation menu: <b-navbar toggleable="lg" class="navbar navbar-expand-lg navbar-light"> <b-navbar-toggle target="nav-collapse" class="mx-auto my-0"></b-navbar-toggle&g ...

Center sidenav material 2 in alignment

Using Angular Material 2 presents a challenge for me: While I can align the text in the sidenav to center, I am struggling to align the button correctly. https://i.sstatic.net/vjHw4.png <md-sidenav-layout fullscreen> <md-sidenav #start mode=" ...

Performing height calculations in JavaScript is necessary to recalculate them whenever there is a

A JavaScript function is used to calculate the height of an iframe element and the document height, then determine if the iframe is on or off based on its height and display properties. The issue arises when changing pages— if the height is less than the ...

Bootstrap dropdown malfunction

I am having trouble with my dropdown menu. The browser is cutting off the blue box in the dropdown area. I'm not sure if I need to add some CSS or make changes to the Bootstrap code to fix this issue. I haven't made any unusual modifications, jus ...

What steps should be taken to prevent divs from overlapping a centrally positioned, unchanging div when the browser is resized

Looking to create a layout with two columns, featuring a fixed sidebar on the left and centering the main content area. The goal is for the centered content to remain in place when resized and not move further left than where it touches the nav bar (left: ...

Sending a delete request mutation using local storage: a step-by-step guide

I'm currently developing a recipe application and facing an issue with the delete button functionality. Instead of deleting the selected recipe from Vuex with local storage, it deletes the most recent one added to the Vuex array. Below is the code sn ...

Tips for removing a specific shape from an HTML element

After spending 48 hours immersed in the world of clip, clip-path, masking, and all things CSS-related, I find myself unable to crack the code on the following challenge: Imagine a red background filling the body of the page. Layered on top of this is a wh ...

JavaScript error leading to ERR_ABORTED message showing up in the console

When I try to load my HTML page, my JavaScript code keeps throwing an error in the console. I am attempting to import some JavaScript code into VSCode using an app module for future reuse. The code is being run through a local server. Error Message: GET ...