What is the best way to align an inline list in the center so that it is responsive across all

Here is the CSS code provided:

.wrapper{
    display: inline;
    line-height: 2em;
    width: 100%;
    height: 100%;
    min-width: 1000px;
    min-height: 1000px;
    text-align: center;
}
ul{
    list-style: none;
}
li{
    list-style: none;
}
.craftbeers{
    color: white;
    margin-top: 85px;
    display: inline-block;
}
.craftbeers h2{
    margin-left: 40px;
}
.winetap{
    color: white;
    margin-top: 85px;
    display: inline-block;
}
.winetap h2{
    margin-left: 40px;
}
.spirits{
    color: white;
    margin-top: 85px;
    display: inline-block;
}
.spirits li{
    margin-left: -40px;
}
.other{
    color: white;
    margin-top: 85px;
    margin-left: 95px;
    line-height: 0.5em;
    text-align: center;
}

Below is the HTML layout for the content:

<div class="wrapper">
    <div class="craftbeers">
        <h2>Craft Beers on Tap</h2>
        <ul>
            <li><bold>BrewDog</bold> Elvis Juice IPA (6.7%)... $7</li>
            <li><bold>New Belgium</bold> Fat Tire Amber Ale (5.2%)... $5</li>
            ...
        </ul>
    </div>

    ... (more HTML content)

    <div class="other">
        <h3>Other</h3>
        <p><bold>Flights:</bold> 4 wine flights.. $15.00... 3 wine flights.. $13.00</p>
        <p><bold>Can't decide?</bold> All samples only $1.00!</p>
        ...
    </div>
</div>

The content was originally designed to fit properly on Mac, but post editing, it no longer fits on Windows or Mac screens. Is a Media Query necessary for this adjustment? In addition, there seems to be confusion regarding the use of inline-block in classes and the wrapper. Should the Wrapper alone be set to display inline, or should each class be set as inline without using inline-block? The website domain related to this content can be accessed at .

Note: Please disregard the part related to ".wineglass". Any assistance or insights on these formatting issues would be greatly appreciated. Thank you.

Answer №1

The issue lies within your css code:

.wrapper{
                display: inline;
                line-height: 2em;
                width: 100%;
                height: 100%;
                min-width: 1000px;
                min-height: 1000px;
                text-align: center;
            }

Using inline elements prevents you from setting a specific width or height. Removing the 'display: inline;' line will default to 'display: block;', allowing for the desired dimensions. Additionally, setting a minimum width of 1000px can create problems on smaller screens where users may need to scroll horizontally to view the entire content.

Another adjustment needed is in the line-height of .other. It's recommended to avoid using a line-height less than 1em to prevent text overlap when multiple lines are displayed, especially on mobile devices.

Answer №2

Have you ever experimented with using Viewport within the header section of your website? Implementing Viewport can greatly improve the responsiveness of your site, especially on mobile phones and tablets.

<meta name="viewport" content="width=device-width, initial-scale=1.0">

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

Having issues with CSS list hovering functionality in Google Chrome

One of the challenges I'm facing with my HTML list is that when hovering over each list item, the text along with the bullet point should change color. Here's the structure: <ul> <li>A bullet point</li> <li>Another ...

What is the process for obtaining an HTML form, running it through a Python script, and then showcasing it on the screen

I am inquiring about the functionality of html and py script. .... The user enters 3 values for trapezoidal data from the html form: height, length of side 1, and length of side 2, then clicks submit. The entered values are then sent to be calculated using ...

Angular 2's solution for a persistent footer at the bottom of the page

I'm currently working on a project using Angular 2, and I'm looking to implement a sticky footer that always stays at the bottom of the page without being fixed. For reference, you can check out an example here: http://codepen.io/chriscoyier/pen/ ...

What is the method to alter the color of an SVG source within an image tag?

I am currently working on a component that involves changing the color of an SVG icon from black to white when a color prop is given. export class CategoryIconComponent extends React.Component { static displayName = 'CategoryIcon'; state = ...

Loop through an array of buttons using an event listener

My HTML and Javascript code currently have the functionality to show/hide a row of 3 images upon button click. However, I need this feature to work for two additional rows similar to this one. I believe it involves looping through an array of buttons, but ...

The appearance of the pop-up mask is displayed at lightning speed

Check out the demo here Here is the HTML code: <div class="x"> </div> <input class="clickMe" type="button" value="ClickMe"></input> This is the JS code: $(".clickMe").click( function() { ...

Currently at the beginning stages of mastering CSS and encountering difficulties with the display property

I am facing an issue with my code .name-bar, .email-bar { border-color: gray; border-style: solid; display: inline-block; } .email-bar { margin-top: 5px; } .div-one, .div-two { border-color: gray; border-style: solid; width: 200px; h ...

Develop a game timer using CreateJS

Looking for advice on the most effective method to create a timer clock using Createjs. I've attempted to reference HTML elements with DOMElement in the past, but encountered difficulties. Essentially, I need to display a timer within a container so p ...

Is it true that textarea is not compatible with AJAX .val() or .text() methods?

I'm attempting to utilize AJAX requests in order to transmit textarea data to a google form, however it appears that .val() isn't functioning correctly with textarea specifically. How can I resolve this issue? My goal is to enable individuals to ...

- Lorem ipsum dolor sit amet, consectetur adipiscing elit

I am looking to create a list with lower-roman indexes that are enclosed in parentheses (ii), where the content of each item is indented. Here is an example: (i) lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ut metus nec urna ...

Ways to create unique hover effects for images in a filter gallery

I recently downloaded a filter gallery from this link and while everything is working fine, I noticed that the hover effect remains the same for all images. The code snippet responsible for this hover effect looks like this: <div class="portfolio"> ...

Trouble with CSS Class Showing Up Only When Hovered

My goal is to make the .panel-text element visible only when a user hovers over the panel. I attempted to use the overlay CSS class, but I encountered issues where the text either wouldn't show at all or would always be displayed. Here is what I have ...

Make sure to include the !important declaration when setting the fill property for

When attempting to apply !important to the fill property of an SVG file, I'm encountering issues with the syntax. Despite my efforts, the !important directive is not being correctly applied to the fill property, resulting in the circle element renderi ...

Having trouble retrieving a base64 encoded image from a MySQL database using PHP

Within my MySQL database, there is a longblob field that stores a binary value representing an image uploaded through my website. I am currently attempting to retrieve the image using: <?php while($record = mysqli_fetch_assoc($result)): ?> <div&g ...

Tips for creating square corner images within a bootstrap card group

How can I create a square image gallery using Bootstrap 4 cards? <div class="card-group flex-wrap"> <div class="card border-dark"> <img class="card-img-top" src="h ...

Creating a Dynamic Canvas Rendered to Fit Image Dimensions

I'm struggling with a piece of code that creates an SVG and then displays it on a canvas. Here is the Jsbin Link for reference: https://jsbin.com/lehajubihu/1/edit?html,output <!DOCTYPE html> <html> <head> <meta charset=&qu ...

Troubleshooting the non-functioning addEventListener in JavaScript

I am facing an issue where a function that should be triggered by a click event is not working and the console.log message does not appear <script src="e-com.js" async></script> This is how I included the javascript file in the head ...

Hiding a Blogger section when its widget is not visible

Take a look at this code: <b:section id='page-list'> <b:widget id='PageList1' locked='false' type='PageList' version='2' visible='true'> </b:widget> </b:section> I wa ...

Tips for increasing the size of a parent div when a child div is displayed with a set width?

Is there a way to make the parent div automatically expand when the child div with a fixed width is displayed onclick? Goal: I want the child div to show up when I click the link, and at the same time, I need the parent div to expand or scale to fit the ...

Tips for displaying an image using the image tag in jQuery

I am looking to dynamically append a share button image after every image tag that meets certain criteria. For the code snippet and demonstration, you can visit this fiddler link here. $(document).ready(function() { $("img").each(function() ...