The generated div from the Repeater Control is lacking appropriate CSS styling

I have a Repeater Control that is being used to generate div elements. While the DIV elements are successfully generated, the CSS formatting is not appearing correctly.

Below is my HTML Code:

<asp:Repeater ID="rptr" runat="server">
        <ItemTemplate>
            <div class="col-lg-4 col-md-4 col-sm-4 mb">
                <a href="VendorProfile.aspx">
                    <div class="twitter-panel pn">
                        <i class="fa fa-twitter fa-4x"></i>
                        <%# DataBinder.Eval(Container.DataItem, "Name") %>
                    </div>
                </a>
        </ItemTemplate>

    </asp:Repeater>

CSS:

.col-lg-4 {
    width: 33.33333333%;
}

.col-md-4 {
    width: 33.33333333%;
}

.col-sm-4 {
    width: 33.33333333%;
}

.mb {
    margin-bottom: 25px;
}

.twitter-panel {
    background: #4fc1e9;
    text-align: center;
}

.pn {
    height: 250px;
    box-shadow: 0 2px 1px rgba(0, 0, 0, 0.2);
}

.fa {
    display: inline-block;
    font-family: FontAwesome;
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.fa-4x {
    font-size: 4em;
}

I am considering adding float styling, but I am uncertain about it. Additionally, this is just a sample and in my project, there will be images in the background so there may not be any icons (like the twitter logo here).

If that's the case, should I create a custom CSS style specifically for this purpose?

Here is my C# code:

public partial class PastOrders : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["vendor"] != null)
        {
            if (!IsPostBack)
            {
                ArrayList values = new ArrayList();

                values.Add(new Testing
                {
                    Name = "Caterer"
                });

                values.Add(new Testing
                {
                    Name = "Florist"
                });

                values.Add(new Testing
                {
                    Name = "Cab Services"
                });

                rptr.DataSource = values;
                rptr.DataBind();
            }
        }
        else
        {
            Response.Redirect("VendorLogin.aspx");
        }
    }



    public class Testing
    {
        public string Name { get; set; }
    }

}

Answer №1

It appears that you may have overlooked adding a closing </div> tag for the

<div class="col-lg-4 col-md-4 col-sm-4 mb">

Implementing that adjustment should resolve the issue!

Answer №2

To apply this styling, use the class "md" or create a new class if you are using it elsewhere and want to apply this style only to that specific class.

.md {float:left;}

If you want to display it as an inline block instead:

.md {display: inline-block;}

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

Creating a Triangle Slider Component with React and Material-UI (MUI)

Struggling with creating a price control using react js and MUI, similar to the image below: https://i.stack.imgur.com/ZP8oc.png I've searched online for libraries or solutions, but haven't found anything that works. ...

Jquery click event only firing once

My challenge is drawing lines between two points, although I've managed to do it once. The issue arises when I try to repeat the process; nothing happens on the second click of a circle. Please note that this functionality only works in modern brow ...

Removing the outline border from a Material IconButton when clicked using styled Components: A guide

Is there a way to remove the outline border that appears when using a material iconButton and it is clicked? I've tried various methods without success. Can styled components help achieve this? Take a look at the image below. Image https://i.sstati ...

Is it possible to link click and onchange events?

My code includes a function that updates an empty array and displays content in two separate HTML elements each time a radio button is selected from a select list. The content is displayed in a div and a ul element. Additionally, I want to display more rad ...

The customized cursor image fails to load after switching the application URL from http to https

After implementing a redirect from http to https in my application, I encountered an issue with custom cursor images not displaying as intended. Prior to the redirect, the custom cursor images worked fine and were visible on the page. The URL for these cur ...

Adjusting grids in Bootstrap according to device orientation

I have a vision for a webpage layout that will feature two columns in landscape mode and switch to one column in portrait mode. Here is an outline of what I have in mind: Landscape: <body> <div class="container-fluid"> <div cl ...

Guide to utilizing ASP.NET Identity 2.0 for onboarding new users through mobile devices

Currently, I am working on an ASP MVC project that utilizes Identity 2.0 for user registration. Users can sign up and create accounts through the Account Controller on the website. Additionally, I have developed an Android application that needs to access ...

What is the reason for Chrome not recognizing 'bottom: 0;' as a valid value for an absolutely positioned footer?

It seems like I may be facing a unique issue with my webpage layout in Chrome. The entire page is set up with absolutely positioned elements within a container that is relatively positioned. Although this setup is not typical, it was necessary for incorpor ...

Using inline-block can be effective on certain occasions

Hi everyone, I'm currently facing a puzzling issue and not sure what's causing it. Sometimes the elements I've set as inline-blocks cooperate as expected, but then when I refresh the browser, they suddenly decide to misbehave. Below is my ...

What is the best way to combine text from various group radio buttons?

Here is the JavaScript code I have written: $(function(){ $('input[type="radio"]').click(function(){ var txt = $(this).parent().text(); var $radio = $(this); if ($radio.data('waschecked') == true) { ...

Arranging multiple Label and Input fields in HTML/CSS: How to create a clean and

I'm struggling with HTML and CSS, trying to figure out how to align multiple elements on a page. I've managed to line up all the rows on the page, but for some reason, the labels are appearing above the input fields when I want them to appear be ...

Safari browser causing Google Plus icon to disrupt alignment

My share buttons at the bottom of my page look fine in Chrome and Firefox: https://i.sstatic.net/4mkbv.png In Safari, not so much: https://i.sstatic.net/X5WbO.png And in Opera, they break too: https://i.sstatic.net/66iXp.png Here is my HTML code: &l ...

Emphasize the most recent file during the document upload process and ensure the scroll bar moves accordingly to the document

I am currently working on a feature where the scroll bar should move to the newly uploaded document in a list of documents. When I upload a new document, I want the scroll bar to automatically move to that document. Currently, the highlighting changes to t ...

Dropdown arrow on triangle point not appearing correctly

My goal is to create enough space between the parent and dropdown menu using a triangle shaped pointer. This is what I am aiming for: This is what I have achieved so far: The CSS code for the triangle shape: .sf-menu ul li:first-child a:after { c ...

Combining several files into a single variable to encode

I'm encountering an issue with the multiple file upload option. Even though it shows that 2 files have been uploaded, when I try to print the encoded value in the console, it only encodes and takes the value of my last uploaded file. How can I encode ...

utilizing the data provided by a user in the "prompt" window within my HTML code

Looking to utilize user input from the prompt window. This is my custom JavaScript form: var answer; function load() { answer=prompt("what is your name?", "Write your name here"); return answer; } function hideNsee() { var HNS = docume ...

Is there any way to determine if Bootstrap has been utilized to build my WordPress page?

I'm currently contemplating if it's worth incorporating Bootstrap into my pre-existing Wordpress site. During my research, an interesting thought crossed my mind - could the template I'm utilizing already be built with Bootstrap? Although a ...

Discovering the best locations for locating CSS color codes

I came across this question which led me to search for the color codes of green, red and yellow in decimal format for the rgba() function. According to this website, I found that green is represented by #008000, equivalent to rgb(0, 128, 0). However, I a ...

Confirmation message for deletion using jQuery on dynamic elements

My div is populated with dynamically added records. Whenever I click on the 'Remove' link, a confirmation box pops up multiple times corresponding to the number of records present in the div. I want the confirmation box to appear only for the spe ...

Creating Positioning Magic with HTML Elements

Currently working on an ASP.NET web app that utilizes a Master, with just a GridView at the bottom and a DIV at the top for further development. The goal is to keep the top DIV or header fixed while scrolling, ensuring it remains in place at the top of th ...