CSS Image Width Percentage Guide

After incorporating Bootstrap into my ASP.NET webpage, I ran into issues when using percentages in the width attribute. Strangely enough, everything worked fine when I switched to pixels instead of percentage. Check out the images below for a visual reference.

https://i.sstatic.net/qeMVD.png

https://i.sstatic.net/8N9vb.png

Answer №1

Take out the pull-right class from the member-role element and experiment with using columns for item alignment.

Answer №2

Original Code

<div class="big-box">

    <div class="member-info">

        <img src="img/team/store.png" alt="admin" class="img-circle" />
        <span class="member-name"><%# Eval("cust_name") %></span>
        <div class="member-role red pull-right">

            <div class="progress">
               <div style="width: 40%;" class="progress-bar progress-bar-striped progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" ></div>     

            </div>
        </div>

    </div>

Removing PULL-RIGHT (thanks @hunzaboy)

<div class="big-box">

    <div class="member-info">

        <img src="img/team/store.png" alt="admin" class="img-circle" />
        <span class="member-name"><%# Eval("cust_name") %></span>
        <div class="member-role red">

            <div class="progress">
               <div style="width: 40%;" class="progress-bar progress-bar-striped progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" ></div>     

            </div>
        </div>

    </div>

Thanks for the assistance everyone. Much appreciated. :)

Answer №3

When determining percentages, they are based on the dimensions of the parent container. It seems likely that the div containing your element does not have a specified width.

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

How can we display a fallback image if the Iframe is unable to load the resource at src in AngularJs?

In one of my JSP pages, I am utilizing an iframe and I want to set an external address as the src of this iframe. Typically, everything works fine. However, in cases where the external source is unavailable, I want to display a static image instead. I&apos ...

The alignment of Bootstrap 4 cards is not coming together as expected

Good morning, I'm currently working on organizing my Bootstrap card elements into rows of 3 cards each. I want the cards to be uniform in height and width, with spacing between them. For instance, if I have 7 cards, I'd have 3 rows of three card ...

Encountering an error message stating, "Unable to assign value to 'onclick' property"

Currently, I am at a beginner level in Javascript. While working on some exercises, I encountered an issue with the 'onclick' function as mentioned above. Despite going through other queries in this forum, I have not found a solution that works ...

Steps for making a dropdown input field:1. Start by defining a

Is there a way to design a dropdown input using CSS or any other method? Take a look at this image for reference: Any suggestions on how to achieve it? ...

Hide the background when the modal appears

I have successfully implemented a jQuery CustomBox modal on my website. However, I am facing an issue with hiding the content div behind the modal once it pops up. My goal is to make the content div reappear after the modal has been closed. You can view a ...

The Angular ng-repeat directive is populating a list with items, but the parameters enclosed in double curly braces

After calling an API, the response contains data in the following format: [{name: "ABC", age: 20}, {name: "DEF", age: 25}] Even though the $scope.names variable is assigned with the array from the API, when viewed in the browser, it displays 2 rows but th ...

Execute an asynchronous task in a single controller function and retrieve the outcome of that task in a separate function

One of my ongoing projects has a lengthy operation that I have mentioned in a few of my previous inquiries (you can refer to my first question and second question for more information). At the start of the project flow, a form is displayed for users to fi ...

Troubleshooting the issue of back-channel logouts in IdentityServer4

Implementing IdentityServer4 with ASP.NET Core 2. There are two clients in play using ASP.NET MVC5. UPDATE: Utilizing cookies for authentication, implicit flow. Employing back-channel sign out as follows: * There are 4 applications involved - two clien ...

CSS: Aligning content vertically centered

Take a look at the following example: <div class="container"> <div class="box1"></div> <div class="box2"></div> </div> The height of box1 is smaller than that of box2. Is there a way to vertically center box1 w ...

Choose a value and subsequently modify it within one query in C#

I am trying to retrieve a value using a select statement and then use that value in an update statement within the same query. using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = connection; cmd.CommandText = "Declare @appln_id int;set @appl ...

Having trouble getting PostCSS nesting to work with CSS variables in Tailwind CSS and Next.js?

I've been attempting to utilize PostCSS nesting alongside CSS variables, but unfortunately the CSS variables are not being converted at all. Instead, I am seeing Invalid property value in the DOM for CSS Variables. The tailwind.css file I have inclu ...

Enhancing React.js with Styled Components: Implementing custom HTML attributes

Currently, we are utilizing styled-components. As we focus on improving accessibility, I am looking to include the tabindex="0" HTML attribute to specific components without passing it as a prop. How can this be accomplished? For instance: <PlayButton ...

Dynamic Bootstrap Tab menu slider with movable functionality when the limit is reached

I am facing an issue with the tabs menu on my website. The tabs menu items can vary between 2 or 3 to even 20 or more. When the number of navigation items exceeds 10, they automatically drop to the second line, which you can see here. However, I don' ...

Guide on displaying a pop-up window upon changing the selected option in a drop-down menu

I am looking to create a popup window that appears when a certain value is selected from a drop-down list. However, I am unsure of how to approach this task and would appreciate a simple example to help guide me. I plan on using panel for the pop up. ...

How can I resolve the vertical adjustment issue of Bootstrap 5 input group on mobile devices?

My current issue involves using Bootstrap 5.2.3 to create an input group that displays a set of spans with the ".input-group-text" class alongside inputs with the ".form-control" class. While this setup works well on a computer screen, it does not adjust c ...

The HTML image file input restricts the user's selection to images stored in the gallery

On mobile devices, when I press the input it displays two options: camera and gallery. However, I only want to select from the gallery. How can I disable the camera option? ...

Tooltip Bootstrap timing

I am currently working on creating a navigation bar with icon-only buttons that display tooltips when touched or tapped. Here is the code I have implemented: $('a[rel="tooltip"]').tooltip({ animated: 'fade', placement: ' ...

Painting with color blends

I need help designing a color selector in the shape of a triangle. I've come across resources like the color wheel (), but I'm unsure how to alter it to resemble a triangle instead of a square. ...

What causes the lower gap to be smaller than expected when using "top: 50%; translateY(-50%);" on specific elements within the parent container?

My top-bar layout needs to have all elements vertically centered, but I'm experiencing issues with the top-bar_right-part not behaving as expected when using the core_vertical-align class. The left menu works fine, however. To illustrate the problem, ...

Having trouble retrieving an HTML page using Node.js

I successfully displayed the home page index.html, however, the pages I want to open as links are not being displayed. Below is the code I used to display index.html: app.get('/', function(req, res){ res.sendFile(path.join(__dirname+'/ ...