Skip to content Skip to sidebar Skip to footer

How To Style Elements For Responsive Web Design?

I have created pie chart using chartist.js I am not able to create responsive web design. When I reduce window size i.e for small window the legend should go above pie chart and fo

Solution 1:

I have modified CSS file as follows:

.ct-pie-chart.ct-legendli.inactive:before {
  background: transparent;
}

.piechart-title {
  text-align: center;
}

.ct-pie-chart.ct-legend.ct-legend-insideli{
  display: inline-block;
}

.ct-pie-chart.ct-legendli {
  margin: 2%;
}

.mychart {
  display: flex;
  align-items: flex-start;
  margin-left: 40%;
}

.ct-pie-chart.ct-legend {
  float: right;
}

In my react component:

Parent component:

<divclassName="mychart"><Pie/></div>

Pie component:

render(){
    return(
         <divclassName="ct-pie-chart">
             {this.piechart}
         </div>
    )
}

Making above changes works fine and now the pie chart and legends do not overlap on each other.

Post a Comment for "How To Style Elements For Responsive Web Design?"