Tips for creating an inline list in MVC

I have a list in MVC that I want to display inline in blocks.

List-

 <ul>
     <li>
@foreach (var item in Model) {
  <img src="@item.cardFilePath"/>
}
    </li>
</ul>

CSS attempted here-

li
{
list-style-type: none; 
display: inline-block; 
float: left;
margin: 0px 24px;
padding-left: 24px;
}

Essentially, there will be dynamically generated images coming through the model and need to be displayed inline.

How can I inline these images being rendered within a list?

Answer №1

Are you facing an issue? Give this FIDDLE a try!

    <ul>
    @foreach(var item in model)
    {
        <li>
            <img src="@item.cardFilePath" />
        </li>
    }
    </ul>

ul {
    list-style:none;
    padding:0;
}
ul li {
    float:left;
    display:block;
    margin-right:10px;
}
ul li:last-child{
    margin-right: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

What is the best way to emphasize searched queries on a Django template's result page?

In my views.py file, I have the following search query: class SearchView(View): def get(self, request, *args, **kwargs): queryset = BlogPost.objects.all() query = request.GET.get('q') if query: queryset = ...

Discovering the clicked button in a partial view during an onSuccess Ajax call

Within my partial view, I have implemented two buttons: Save and Preview. Both buttons are functioning as expected, with Preview enabling widget preview and Save saving data to the database. However, I am encountering two issues: I am unable to determine ...

ways to conceal the default icon in bootstrap navbar

I am looking to incorporate Bootstrap tags into my HTML file in order to display my menu items. However, I want to avoid having the default navbar highlight box and hamburger icon appear when users visit my site using a tablet or mobile device. <nav cl ...

Ways to incorporate HTML elements into a forthcoming HTML element (React or JavaScript recommended)

As I work on enhancing the accessibility of some HTML content that is loaded through a third-party application, I find myself faced with the challenge of adding accessible elements to dynamically spawned list items with anchor tags. My attempt to achieve ...

What is the best way to place tfoot at the top of the table

Below is the structure of my table: https://i.stack.imgur.com/QmlVn.png In the table, there are search input fields at the bottom of each column. I would like to move them to the top, right after the <thead> </thead>. The basic HTML code for ...

Position DIVs next to each other

After scouring through countless Stack Overflow threads in search of a solution to my issue, I still can't seem to get it right. Everyone suggests using float: left, float:right, overflow: hidden, display: block, etc., but none of them are working for ...

Enhance the visibility of pop-ups across all pages

I'm currently working on a feature to maximize my popup, specifically an iframe. Here is the JQuery code I am using for this functionality: $(document).ready(function(){ $('#"+btnMaximiza.Id+"').click(function(){ $('#"+btnMaxim ...

Can a universal selector be used to target a specific nth element and all subsequent occurrences of that element type?

As I navigate through using a data scraper, I find myself in the realm of code where my knowledge is limited. The tool I am using is free but comes with its limitations such as a crawl limit and no option to resume from the endpoint. My goal is to scrape ...

Vue 3 allows for creating multiple cards with unique contents

I received this outcome: Content duplicated but not cloned as a card element Below is the code snippet <script setup> import { ref } from 'vue'; defineProps({ project: String, }); const projectList = ref([ { img: './src/asse ...

Accessing Json Data Using AngularJS User Authentication

Currently, I am in the process of developing a user login page that stores user information in a json file. I have successfully created the GET method for accessing the file, but I am facing difficulty in redirecting the user after a successful login. Any ...

The jasmine and protractor combination couldn't locate the specified element using its tagname

Why does my test keep failing in Protractor when trying to find the element by tag name? it('should display the test component', async () => { await browser.get('/trade') element(by.tagName(('test-component'))).isP ...

Conceal the toolbar element if it is not at the top of the page

I am encountering an issue with my toolbar. When I scroll down, the transparent background of the toolbar disappears and it looks like this: https://i.sstatic.net/YxZQe.png. How can I hide this component when the page is scrolled down and show it again whe ...

The layout of a message board post (entirely in HTML and designed to fill 100

I have a design challenge at hand. I want the signature to always appear at the bottom of the post content, regardless of the height of the post (which has a minimum height equal to or higher than that of the avatar). Currently, when the post height is set ...

Animate failed due to the appending and adding of class

$('#clickMe').click(function() { $('#ticketsDemosss').append($('<li>').text('my li goes here')).addClass('fadeIn'); }); <link href="http://s.mlcdn.co/animate.css" rel="stylesheet"/> <script ...

Tips on incorporating background color into HTML emails dispatched via PHP mail()

Struggling to add a background color to my HTML email. I've attempted various methods: Inserting <script> tags with CSS code inside Adding bgcolor in body tags Using a CSS style sheet All to no avail. I suspect it could be the email provi ...

What could be causing the top navigation bar's background color to not display properly?

Currently working on a website and trying to implement a top navigation bar. However, encountering an issue where the background-color is not displaying properly and appearing transparent. CSS: body { margin: 0; font-family: "Century Gothic", Cent ...

The transparency of an image is being lost when it is used in a modal

I am facing an issue when trying to append a modal that contains only a transparent gif. The problem arises when the transparent background of the gif is not displayed properly. There seems to be no issue with the transparency settings of the gifs themselv ...

What is the technique of passing objects using jQuery's ajax function?

I'm trying to send an object to a controller action, but it's not working. The object is null with no errors. I've debugged it and confirmed that the parameters are being passed correctly. scripts $(document).ready(function () { var Irregu ...

Triggering a jQuery event when the close button on a modal dialog is

In my Oracle APEX page, I have a modal dialog region with an inline dialog template. I am trying to trigger an action when the user clicks the close button on the dialog. Here is the code I have written: $(".ui-button.ui-widget.ui-state-default.ui-corner- ...

Creating a Star Rating system with jQuery using a dropdown menu for multiple selections

Recently, I came across a simple jQuery Star rating system that I want to implement on my website. I have been following the code from http://jsfiddle.net/, and it works perfectly for one star rating system. However, I have multiple star rating systems on ...