Issue with HTML and CSS Grid alignment coupled with CSS syntax error on RBRACE

I'm in the process of updating my website indexes and decided to incorporate grids. However, when attempting to implement grids using Dreamweaver, I encountered several issues. Firstly, an error message appeared stating "Expected RBRACE at line 72, col 53." Secondly, the grid didn't align as a 4 by 5 layout, with the content inside not resizing correctly. Lastly, the image within the div didn't cover the div identified by the class name "inside-box." Can anyone provide a solution to this problem? Your help would be greatly appreciated. Apologies for the lengthy code; I'm relatively new to Stackoverflow.

I've attempted to align the divs and remove grid-template-columns, but these solutions didn't work.

Edit: Here is the link to my webpage:

/*The CSS for making the grids.*/
.wrapper{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(4, 1fr));
  grid-column-gap: 0.5px;
  grid-row-gap: 75px;
  grid-auto-rows: minmax(200px, auto);
}

/*For each individual box.*/
.box{
  border: 1px solid black;
  min-width: 20%;
  background-color: white;
  margin: 0;
}

/*Creates the styling of the dropdown box.*/
.dropdown-content {
  display: none;
  position: relative;
  background-color: blue;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  padding: 12px 16px;
  z-index: 1;
}

/*Makes a dropdown box when hovered over.*/
.inside-box:hover .dropdown-content{
  display: block;
}
<!--HTML FILE-->
<div class="wrapper">

   <!--Lab 1-->
   <!--Each individual box.-->
   <div class="box">

     <!--The box inside each individual box. Think of it as like bubble wrap inside a box.-->
     <div class="inside-box">

       <!--The div with an image in it. Top one inside the box div.-->
       <div>
         <img src="">
       </div>

       <!--The div that contains the heading or title of the lab.-->
       <div class="txtBar">
         <h3>Lab 1</h3>
       </div>

       <!--The div that drops down to explain the lab with some text.-->
       <div class="dropdown-content">
         <p>Explanation of text.</p>
       </div>

     <!--End of inside box div.-->
     </div>

   <!--End of box div.-->
   </div>

   <!-- Lab 2 onwards... -->

</div>
 <br>
<!--END OF HTML FILE-->

I anticipate the layout to conform to a 4 by 5 grid seamlessly without any errors.

Answer №1

The primary issue can be found in the following line:


/* incorrect */

grid-template-columns: repeat(auto-fill, minmax(4, 1fr));

auto-fill is causing the column to fill the entire grid area. To resolve this, use the following line instead:


/* Try this instead */

grid-template-columns: repeat(4, 1fr);

I am unsure of the precise goal at hand and therefore unable to provide feedback on other aspects. Please clarify your objective here.

Additionally, for those serious about enhancing their development skills, it may be beneficial to explore alternative code editors such as VS Code, Atom, or Sublime.

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

What is the best way to place a vertical line above the text when it is in use?

How can I add a vertical line above the active element using CSS? I was recommended to use either :before or :after, but I'm not sure how to implement them. I tried using :after without success. Any advice on achieving this effect? See the design exam ...

How to implement jquery select functionality on clickable table rows?

I've come across a challenge while trying to implement clickable table rows with the jquery selectable function. Everything works perfectly fine with li elements, but I seem to hit a roadblock when using tables - the click event just stops working. Wh ...

Bootstrap 4 - DropDown option - Element is positioned above the navigation bar

Currently facing an issue with the DropDown menu. Whenever I add padding to the DropDown menu (class - drop_link), it ends up pushing the entire element over the <nav>. I'm unsure of how to prevent this from occurring. I attempted to disable som ...

Retrieve information from internet sources

I'm attempting to extract the initial paragraph from Wikipedia by utilizing only JavaScript. Essentially, my goal is to: document.getElementsByTagName("P")[0] However, this content is not present on my own website; instead, I aim to retrieve a speci ...

Modify the main container width based on the size of the table

Would it be possible for the main container width to increase along with the table width? Is that achievable? <div class="container main-con"> <table class="table table-hover"> <tr><td></td></tr> </table> ...

Difficulty with NodeJS, Hapi, and Cascading Style Sheets

I've decided to challenge myself by creating a small webhost using Node.js with hapi. Even though I'm not an expert in Node.js, I am eager to learn as much as possible. Currently, my main issue revolves around fetching a CSS file from an include ...

Zurb Foundation's sections have a strange issue where navigating between them introduces unexpected whitespace

I'm feeling frustrated as I try to work with Zurb Foundation sections. I've updated to the latest version 4.3.1. Following the documentation provided here: but encountering strange behavior while navigating through results. Refer to the screen ...

Is there a way for me to choose every element excluding those contained within a specific div?

Check out my code snippet: <div class="car"> <div class="make">NISSAN</div> <div class="model">MICRA</div> </div> <div class="discontinued"> <div class="car"> <div class="make">FOR ...

ScriptManager is not accessible in the current ASP.Net Core Razor Page context

I'm facing an issue where I have a view (such as Index.cshtml) and a page model (like Index.cshtml.cs). In the view, there's a JavaScript function that I want to call from the OnPost() method in the page model. I tried using ScriptManager for thi ...

I am seeking to showcase an image in a window, and upon the image being clicked, execute the code in a separate window

I am looking to showcase the image provided below. <img src="http://gfx.myview.com/MyView/skins/livesample/image/livesample.gif" alt="" border="0"><a/> Once the image is clicked, I want it to execute the following code. How can I ensure that ...

I am attempting to dynamically align the images of two articles. The exact heights of the containers are not specified. Can anyone provide guidance on how to achieve this?

My code snippets: <article class="featured"> <img src="http://www.placehold.it/300x100/ff0000"> <p> <!--Text--> </p> </article> <article class="sub-featured"> <img src="http://www.placeh ...

An issue occurred while trying to retrieve the js file, as an error with code net::ERR_ABORTED 404 (Not

Although this question has been asked before, I am unsure where to find the solution. My express backend server needs to render an HTML page with main.js in it upon launch. app.js code: var createError = require('http-errors'); var express = req ...

Keeping the header in place: fixed positioning

This particular situation is quite challenging for me. I have a webpage that requires horizontal scrolling. There is a menu at the top of the page that needs to remain centered on the page at all times. Even with the use of jQuery, I am uncertain how to ac ...

Experiencing a PHP Contact Form Problem - Unable to Identify the 400 Error Cause

Greetings! I'm fairly new to all this website creation stuff and I'm currently working on setting up a contact form from a template that I stumbled upon. Despite my best efforts in configuring the PHP code, I keep encountering a 400 response erro ...

Having trouble with Vue.js not returning HTML elements from methods properly?

I have been attempting to retrieve html elements from a method, and I thought of using v-html for this purpose (not sure if there is a better approach). However, I seem to have encountered an issue with backtick templates and string interpolation. An error ...

Having trouble getting CSS Animation to work in a React project?

I am currently developing a Next.js application using React. const partyButton = useRef(null) const handleParty = () => { setTimeout(() => { partyButton.current.classList.add('party-time'); console.log(party ...

Why do the back button and custom scroller behave differently on two different webpages?

I’ve added the malihu custom scroller to my website, but it’s behaving differently compared to how it works in the demo. I can’t seem to figure out what's causing this discrepancy. For reference: Demo: check here Website: visit here The fo ...

The fixed navigation bar is obscured by the address bar in Chrome mobile

After starting a new project, I encountered an issue with my fixed navbar while testing it on Chrome on mobile iOS. Initially, I believed it to be a browser bug, but after reviewing previous projects, I realized that they functioned properly with the fixed ...

Troubleshooting JavaScript for Sidebar Disappearance due to marginRight and display CSS Issue

I need to adjust the layout of my website so that the sidebar disappears when the window is resized below a certain width, and then reappears when the window is expanded. Here is the HTML code: <style type="text/css"> #sidebar{ width:290 ...

Troubleshooting Hierarchical Ordering in Django-MPTT's recursetree Function

I am currently utilizing the django-mptt package within my Django application, and I have encountered an issue when trying to use the .order_by() method in conjunction with a filter. Despite attempting different criteria for ordering, the results remain un ...