Center and left-align elements

I want to make my list items align like the dropdown menu shown at the bottom of the picture.

The items in the dropdown are centered and aligned vertically in a single line. How can I achieve this effect?

Below is the code snippet I am using:

<div class="footer">
            <div class="outer">
                <div class="container">
                     <ul id="insurances">
                        <li><a href="conditions-form.html"><img src="img/estate-insurance.png">Property Insurance</a></li>
                        <li><a href="conditions-form.html"><img src="img/tourist-insurance.png">Travel Insurance</a></li>
                        <li><a href="conditions-form.html"><img src="img/health-insurance.png">Health Insurance</a></li>
                        <li><a href="conditions-form.html"><img src="img/car-insurance.png">Car Insurance</a></li>
                        <li><a href="conditions-form.html"><img src="img/assistance-insurance.png">Assistance Insurance</a></li>
                        <li><a href="conditions-form.html"><img src="img/NNW-insurance.png">Accident Insurance</a></li>
                        <li><a href="conditions-form.html"><img src="img/law-insurance.png">Legal Protection</a></li>
                    </ul>
                    <p>Looking for</p>
                    <a class="insurance-type">
                        <span>Property Insurance</span>
                    </a>

                    <div clas="clear"></div>
                </div>
            </div>

And here is the corresponding CSS:

    .footer .outer .container ul {
    position: absolute;
    border:none;
    padding: 0;
    margin: 0;
    bottom:110px;
    left:0;
    right:0;
    display:none;
}

    .footer .outer .container ul li a img {
    height: 25px;
    margin-right: 20px;
}
.footer .outer .container ul li {
    padding:0;
    margin:0;
    list-style: none;

}
.footer .outer .container ul li a {
    color: #fff;
    text-decoration: none;
    font-size:21px;
    font-family: 'Lato', sans-serif;
    font-weight: 300;
    text-align: left;
    margin: 0 auto;
    display:block;
    height: 70px;
    line-height: 70px;

}

Any suggestions on how to achieve this layout would be greatly appreciated. Thank you!

Answer №1

Created a quick mockup, possibly this fits your needs http://jsfiddle.net/kasperoo/eHLBu/1/

<div class="container">
  <ul id="insurances">
    <li><p><a href="conditions-form.html"><img src="img/estate-insurance.png">Real Estate Insurance</a></p></li>
     <li><p><a href="conditions-form.html"><img src="img/estate-insurance.png">Real Estate Insurance</a></p></li>
     <li><p><a href="conditions-form.html"><img src="img/estate-insurance.png">Real Estate Insurance</a></p></li>
</ul>


.container {
    position: relative;    
}
#insurances {
    list-style-type: none;
    width: auto;
}
#insurances li p {
    margin: 0;
    width: 200px;
    margin: 0 auto;
}
#insurances li:nth-child(even) {
    background: green; 
}
#insurances li:nth-child(odd) {
    background: grey; 
}

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 extract a JSON object from a website search using getJSON or similar techniques?

Can anyone provide guidance on utilizing .getJSON() to access JSON-encoded information from a website that is being searched? I've implemented a Google Custom Search API for my site with the aim of retrieving the JSON file from the search results. Fo ...

How numerous data attributes are available within Bootstrap? What functions do they perform and what possible values can be assigned to them?

Lately, I've been exploring the world of data attributes in Bootstrap such as data-toggle, data-trigger, and data-ride. However, my search for a comprehensive list of these attributes has come up short. I'm curious about the potential values tha ...

Are HTML custom data attributes being included in Google's indexing?

Currently, I am in the process of developing a portfolio module that relies on AJAX, pushState, and hash bangs. Since I am targeting browsers with JavaScript enabled, my main concern lies in the limited capability of HTML custom data attributes for SEO. T ...

When passing a parameter in a JSP page, it returns a null value

How can I display the name of my image like so? This is a simple post request from demo.jsp to itself. <form method="post" action="demo.jsp"> <input type="hidden" id="sql" name="name" value="sql"/> <input type="image" src="images/icons/ic ...

Problem with input field borders in Firefox when displayed within table cells

Demo When clicking on any cell in the table within the JSFiddle using Firefox, you may notice that the bottom and right borders are hidden. Is there a clever solution to overcome this issue? I have experimented with a few approaches but none of them work ...

Issue with Vuetify v-alert not appearing after updating reactive property

I am trying to set up a conditional rendering for a v-alert if the login response code is 401 Unauthorized. Here is how I have defined the alert: <v-alert v-if="this.show" type="error">Invalid email and/or password.</v-alert> Within the data ...

Arrangement of Div Box

Here is the HTML code that I am currently working with: <div class="item"> <div class="pageheader"> Header </div> <div class="info"> Created on... </div> <div class="image"> I ...

How to Change Text When Accordion is Expanded or Collapsed using Javascript

Help needed with JavaScript accordion menu for displaying indicators in front of section headers. The goal is to show a (+) when collapsed and (-) when expanded. The current code only changes on click, not based on the section's state. Looking for fre ...

Troubleshooting the Issue: Iscroll.js Child Element Overflow Scroll Problem on iOS Devices

In my current project, I'm utilizing Iscroll.js to create a design where all elements must adjust to the height of the screen with a significant horizontal scroll. However, I've encountered an issue with certain elements overflowing vertically ba ...

Enlarge the input field when it is selected

Is there a way to expand a search box towards the left instead of the right when focused? The code provided below expands the search box to the right. HTML: <input type="text" placeholder="search"> CSS: input[type="text"] { background: #444; ...

What is the best way to align a div with a td within a table?

I have a table and I inserted a div inside it, but now the alignment with the td is off. I applied display: inline-block to both the td and div elements, but the td only shifted slightly. How can I correct this? Here's my HTML code for the table : ...

The document.getElementsByClassName method in JavaScript is returning an Array with a length property value of 0

My HTML contains a list of li elements with one class. I am attempting to collect them all and place them in an array to determine how many have been gathered. However, when I attempt to display the number using the .length property of the array returned b ...

Creating divs that adapt to different screen sizes without relying on flexbox

Currently, I am in the process of developing a chat interface where the viewport height is set to 100vh. The layout consists of a header/navbar, a "main content" section, and a footer housing the input field (you can view the code here) The way I have str ...

Styling code for a layout with two columns aligned to the left using

I am looking to create a layout where two pieces of text are displayed side by side in columns using CSS. The left-hand column will have variable length text, while the right-hand column will have fixed length text. The desired layout should show the two ...

Verifying completed fields before submitting

I'm in the process of designing a web form for users to complete. I want all fields to be filled out before they can click on the submit button. The submit button will remain disabled until the required fields are completed. However, even after settin ...

Specialized hover mission

Do you have a question? Imagine you have 3 spans where the default color is black. When you hover over a span, its color changes to red. But what if I told you that at the start, the first span has an orange color. Now, I want to hover over the orange on ...

Creating a distinct value in Master details within Angularjs

Utilizing AngularJS, I am fetching data from an API and displaying it on an HTML page. The issue arises when the SQL query, which involves a join between two tables (departments and employees), repeatedly fetches department data for each employee. My goal ...

Optimize your website by caching static pages and content using Node.js

When it comes to caching static content using nodejs, there seem to be two main methods that can be utilized: The first method involves using nodejs and utilizing the following code: app.use(express.static(path.join(__dirname, 'public'), { max ...

Can Jquery use .hover to add a class or Child:hover to impact its parent element?

I have been searching for a solution tailored to my specific needs, and I am encountering difficulties in getting a seemingly simple jQuery code to function as expected. Here is the link to my basic fiddle: http://jsfiddle.net/LBHxc/ (I apologize for the ...

What is the best method for creating numbered paragraphs using HTML5 and CSS3?

Currently, I am putting together a QuickBASIC 4.5 manual in HTML5 and have made progress with it. However, I am looking for a way to add line numbers or prevent text wrapping in my code snippets. The current format of my code is as follows: 1. PRINT "Hell ...