showcasing a row of 10 items all at once

How do I make my bubble chart responsive? I want to display only 10 bubbles for large screens and have the number of bubbles per row decrease as the screen size gets smaller. I initially tried setting the width of each bubble to 10%, but it didn't work well for responsiveness.

.chart-padding{
  padding: 20px;
}

.ten-bubbles{
  width: 10%;
}

.qs {
  top: 25px;
  position: absolute;
  display: inline-block;
  /* display: flex; */
  left: 50%;
  margin-left: -9px;
  z-index: 2;
}
<div class="container-fluid border" style="background-color: white;width:90%;">

  <ng-container *ngIf="analytics.length > 0">
    <div class="row chart-padding">
      <div class="ten-bubbles col-sm-3 col-xs-6" style="cursor: pointer; height: 70px;" *ngFor="let prof of analytics;let i=index"
        (click)="selectedQstn = i">
        <span class="qs">Q{{i + 1}} <a href="#question-view"></a></span>
</div>
</div>
</ng-container>
</div>

Answer №1

It appears that your code snippet may be incomplete (missing Angular perhaps?)

In any case, there are a couple of options available in this scenario:

  • Implement Flexbox by potentially substituting width with flex-basis for .ten-bubbles, along with applying flex-wrap: wrap on .qs.
  • Utilize @media queries to override the width based on different viewport sizes. It could be beneficial to prioritize designing for mobile first and then adapting for larger viewports.

Answer №2

To maintain a maximum of 10 visible bubbles while adding an extra row, the width of the bubbles should be determined by the size of the grid cell they inhabit. This approach heavily relies on the responsiveness of the grid system.

If you wish to decrease the number of visible bubbles, you can introduce conditional rendering to limit the display on smaller screens:

<div class="ten-bubbles col-sm-3 col-xs-6" style="cursor: pointer; height: 70px;" *ngFor="let prof of analytics; let i=index"
    (click)="selectedQstn = i">
    <div ng-if="i <= 7; else hideOnSmallScreen">
        <span class="qs">Q{{i + 1}} <a href="#question-view"></a></span>
    </div>

    <!-- hiding the last 3 elements on medium screens-->
    <ng-template #hideOnSmallScreen>
        <span class="qs d-md-none">Q{{i + 1}} <a href="#question-view"></a></span>
    </ng-template>
</div>

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 use jQuery to update the color of an SVG shape?

Hello everyone! I'm excited to be a part of this community and looking forward to contributing in the future. But first, I could really use some assistance with what seems like a simple task! My focus has always been on web design, particularly HTML ...

Create waypoints on multiple elements

I am working on implementing a unique feature using a div tag with the class "dipper." <div class = "dipper"> <p>Peekaboo</p> </div> As part of this implementation, I have included a script that triggers the display of the "dipper ...

The iPage server has encountered a 403 Forbidden Error, preventing

My website is linked with WordPress, but I'm encountering a 403 forbidden error in the sub-menu. Can someone assist me with this issue? I have uploaded a screenshot of the folder in iPage here Additionally, I want my WordPress page to show up correc ...

Display 3 images with the carousel feature on the middle image

Currently, I am utilizing the jquery.jcarousellite plugin and attempting to make the second image active. Below is the code snippet I have tried: <div id="jcl-demo"> <div class="custom-container auto moreItems "> <a href="#" c ...

There seems to be an issue in AngularJS 6 with trying to read a property that is undefined, resulting in a TypeError

I keep seeing the error message "Cannot read property '0' of undefined". This snippet shows my HTML code: <!-- ... --> <img src="{{hit._source.productPhoto[0].docURL}}"> Below is a snippet of my JSON data: "hits": [ { "_inde ...

How to set a default class for Bootstrap tabs using AngularJS

I'm working with an angular tabbable element and I need to set a default tab as well as add a specific class to one of the tabs. For example, I want tab 2 to be selected by default and give tab 1 a specific class. Here is the link to the code: http:/ ...

What causes the variance in style between the two div elements?

As I delve into the world of styled-components, I decided to create this component: import React from 'react' import styled from 'styled-components' const Row = styled.div` ` const Column = styled.div` flex: 0 0 50%; max-widt ...

What is the best way to update a section of an HTML file without changing the entire "inner.html"?

I'm working on a counter that can either count backwards or in ascending order based on requirements. The counter is functioning correctly, but I want to add text to accompany each number as it counts. The issue is that the text changes every time the ...

Reloading the same page with looping HTML forms through Ajax postback

I've been developing a complex multi-part form for my WordPress website, consisting of 3 forms that are loaded sequentially on a single page. The first form is displayed initially, while the second and third forms remain hidden. To achieve this, I upd ...

annoying box filled with information

Take a look at my http://jsfiddle.net/8wSzk/2/ <div class="row1"> <div> <div class="circle-menu"> </div> <p> some option </p> </div> <div> <div class="circle-menu"> </div> ...

Guide on setting up a responsive layout using Bootstrap 4.0.0-beta for various screen widths

I am working on building a website using bootstrap4.0.0-beta. The designer who created the layout for this site designed it with a container width of 1070px. My goal is to use this single layout for all breakpoints, meaning that regardless of the device wi ...

Activate the jquery function when the content of the <ul> element changes

Looking for a way to trigger a jQuery function when the content of an unordered list (ul) changes. Check out the code I've written below: JavaScript jQuery(document).ready(function($) { $('.ProductList').on('change', fun ...

Is there a detailed HTML page specifically designed for CSS testing?

I am in search of sample code featuring the use of semantic HTML to test stylesheets. The version/doctype is flexible, but HTML5 would be preferable. By "comprehensive," I mean incorporating definition lists, forms, tables, and all other standard element ...

Identifying the element with the specified ID within the table's <th> tag in JavaScript

I want to create a table with the title: Summary Statement as of August 3, 2017 at 12:55 The date is functioning properly using JavaScript in other parts of the code, but not in this section. Is there a specific technique I should be aware of? The rest of ...

What causes the element to load with a transparent appearance? And why is my JavaScript code overriding the hover effect on it?

My goal is to have an element fade out when clicked and then fade back in when its space is clicked again. I also want the opacity of the element to be 0.9 instead of 1 when visible. I've encountered two issues with my code. First, the hover selector ...

The onload event for embedding SVG files is not functioning as expected

I created an angular directive: <div> <embed ng-src="{{url}}" id="map" type="image/svg+xml/> </div> I am trying to trigger a function when the svg is fully loaded. To achieve this, I have added an onload action listener durin ...

Transitioning with a CSS cubic-bezier function results in a noticeable jump of the content

My transition in an accordion list is using cubic-bezier(0.68, -0.55, 0.265, 1.55), but the issue I am facing is that the content below is also 'jumping'. Does anyone have suggestions on how to create space below my accordion (ul list) so that w ...

Using either Canvas.toBlob or Canvas.toDataURL results in me obtaining an image with a transparent

Hey there! I'm currently working on a project that requires the user to crop and upload images. For cropping, I am utilizing react-cropper. My challenge lies in dealing with Chrome's limitation on dataURL to 65529 pixels as mentioned in this M ...

Error: Unable to locate the reference

Having trouble with my JavaScript code not recognizing the linked .js files I added. I initially linked them through CodePen, but manual references don't seem to be working. Attempted suggestions from this page Why does jQuery or a DOM method such as ...

Is your CSS file functioning properly in Chrome but not in Internet Explorer?

I recently developed a custom SAP Portal Component that includes a JSP file with Javascript. This component is placed on a SAP Portal page alongside another iView, which contains multiple headers and text within an iframe. My objective is to dynamically ge ...