Lab Workbook: European Art History Gallery Webpage
Objective: To create a media gallery webpage showcasing European art from the 1500 Renaissance to the 18th Century using Flexbox and CSS for styling and layout.
To incorporate the responsive design media queries shown in the image into your HTML project, you should place them in your CSS file (in this case, gallery.css), which is linked in the <head> section of your HTML.
Media queries are part of CSS and are not written directly in the HTML file.
Step 1: Open the gallery.css File
Locate the file gallery.css (referenced in your HTML as <link rel="stylesheet" href="gallery.css">) and open it for editing.
Step 2: Add the Media Queries
Place the media queries at the end of the gallery.css file (or wherever appropriate within your CSS file).
For example:
/* Default styles for .artwork (applies to larger screens by default) */
.artwork {
width: 25%; /* Example default width */
margin: 10px;
}
/* Media query for screen widths 800px or smaller */
/* Media query for screen widths 500px or smaller */
@media (max-width: 500px) {
.artwork {
width: 100%; /* Full width for very small screens */
}
}
Step 3: Save Changes
Save the updated gallery.css file.
Step 4: Test in the Browser
Open your HTML file in a browser and resize the browser window. The .artwork elements should adjust their width dynamically based on the specified breakpoints (800px and 500px) in your media queries.
Explanation
Default Styles: The .artwork element has default styles that apply unless overridden by a media query.
Media Query at 800px: When the screen width is 800px or smaller, .artwork elements adjust their width to calc(50% - 20px), creating a responsive layout.
Media Query at 500px: When the screen width is 500px or smaller, .artwork elements take up the full width of the screen (100%), ideal for mobile devices.
By adding these media queries to gallery.css, your design will adapt gracefully across different screen sizes.
Part 4: Conclusion and Exercises
Exercise 1: Add interactivity with JavaScript to filter artworks based on the art period.
Exercise 2: Implement a lightbox feature for viewing artwork images in full size when clicked.
Exercise 3: Create a dynamic timeline slider to navigate through different art periods on the webpage.
This workbook provides a structured approach to building a gallery webpage for European art history. It covers key concepts in HTML and CSS, including Flexbox for layout and responsive design. The exercises encourage students to enhance the webpage with interactive features and dynamic content.
Exercise 1: Add interactivity with JavaScript to filter artworks based on the art period: provide detailed CSS and HTML to deliver Exercise 1: Add interactivity with JavaScript to filter artworks based on the art period.
To implement Exercise 1, where we add interactivity with JavaScript to filter artworks based on the art period, we will need to modify the existing HTML structure and add CSS for styling the filter buttons. We will also write JavaScript to handle the filtering functionality.
Step 1: Update the HTML Structure
Add buttons for each art period at the top of the gallery for filtering:
This JavaScript code adds an event listener to each filter button.
When a button is clicked, it sets the display of each art period section based on the data attribute of the button. This allows the user to filter the artworks by the selected period.
With these steps, you should have a functional filter for your gallery webpage that allows users to view artworks based on the chosen art period.
Here's the complete HTML with inline CSS and JavaScript, including 3 representative paintings for each epoch. The layout is designed using flexbox for presenting images, and other CSS concepts like media queries, hover effects, and responsive design are incorporated. Replace the src attributes in the <img> tags with the paths to your downloaded images.