I'm using mpdf 6.0.
The issue is when I css as 10%
<div class="progressbar">
<div class="progressbar-value bg-color-green" style="width: 10%; overflow: hidden;"> 10%</div>
</div>
The result as:
And when I add 3%, it covers the whole width
<div class="progressbar">
<div class="progressbar-value bg-color-green" style="width: 3%; overflow: hidden;"> 3%</div>
</div>
The result is:
Please guide me to solve this problem.
PHP:
<?php
set_time_limit(600);
ini_set('display_errors', 'Off');
ini_set("memory_limit","256M");
require 'mpdf.php';
$mpdf = new \mPDF();
$html = "";
$html .= <<<EOD
<div class="progressbar">
<div class="progressbar-value bg-color-green" style="width: 3%; overflow: hidden;"> 11%</div>
</div>
EOD;
$stylesheet = file_get_contents('style.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($html, 2);
$mpdf->Output('','I');
exit;
?>
CSS (style.css):
.progress, .progress-bar, .progressbar {
position: relative;
display: block;
background: rgba(0, 0, 0, .05);
overflow: hidden;
font-weight: bold;
line-height: 20px;
height: 20px;
border-radius: 4px;
color: white;
}
.progressbar-value {
display: block;
white-space: nowrap;
overflow: hidden;
}
.text-left {
text-align: left !important;
}
.bg-color-green {
background-color: #61BD4F;
}
I solved the above issue by using background: linear-gradient() and background-size: x%
<div class="progressbar" style="float:left;">
<div class="progressbar-value" style="background-image: linear-gradient(to left, #00FF00 100%); background-size:3%;float:left; height:15px;width:100%;">
<div class="text" style="text-align: left; float: left;display:block;font-size:12px;height:15px;">3%</div>
</div>
</div>
Now the result is
Related
I have a comment section on my page, And I add a scroller for comments. If in the comments section there are no comments then I want to hide the scroller bar. In my CSS I give overflow: auto; but still it shows scroller bar when there are no comments.
CSS:
<style>
.scrollbar
{
margin-left: 30px;
float: left;
height: 300px;
width: 100%;
margin-bottom: 25px;
overflow: auto;
}
.force-overflow
{
min-height: 450px;
}
#style-6::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
#style-6::-webkit-scrollbar
{
width: 10px;
background-color: #F5F5F5;
}
#style-6::-webkit-scrollbar-thumb
{
background-color: #F90;
background-image: -webkit-linear-gradient(45deg,
rgba(255, 255, 255, .2) 25%,
transparent 25%,
transparent 50%,
rgba(255, 255, 255, .2) 50%,
rgba(255, 255, 255, .2) 75%,
transparent 75%,
transparent)
}
</style>
Code:
<div class="scrollbar" id="style-6">
<div style=" height:270px;" class="force-overflow">
<?php foreach ($userComments as $comment):?>
<div class="post-details-wrapper">
<?php
$postdate =strtotime($comment['timestamp']);
$now = time();
?>
<div class="col-sm-12">
<p>
<img style="height: 45px;width: 48px;border-radius:50%;" src="<?php echo base_url();echo $comment['thumb_url']?>" />
<b style="padding-right:6px;padding-left:6px;border-radius:25px;background-color:#888888;color:white;font-family:Roboto, Arial, sans-serif;font-weight:500;>"><?php echo $comment['username'];?></b>
<?php echo date('d-m-Y',$postdate);?>
</p>
</div>
<div class="col-sm-12">
<p style="font-size:15px;"><?php echo $comment['comment']?></p>
</div>
</div>
<?php endforeach;?>
</div>
</div>
In the bellow image, you can see the scroller bar present when no comments.
try to set: overflow-y:auto; instead of overflow:auto;
Maybe it will help
make scroll bar height to min-height: 300px . It may help.
.scrollbar
{
margin-left: 30px;
float: left;
min-height: 300px;
width: 100%;
margin-bottom: 25px;
overflow: auto;
}
I'm trying to make a dynamic donut chart with data coming from custom fields in Wordpress.
At the moment it's not calculating the strips in the chart correctly - here's my fiddle https://jsfiddle.net/sq6mh5wp/. Just as an example I've set the four strips to be a quarter but it's only showing 3 strips, where am I going wrong?
Here's the actual template:
<div class="container">
<div class="donut-chart-block block">
<div class="donut-chart">
<?php if( have_rows( 'pie_chart' ) ):
$counter = 1; ?>
<?php while( have_rows( 'pie_chart' ) ): the_row(); ?>
<div class="clip clip-<?php echo $counter; ?>" style="transform: rotate(<?php echo the_sub_field( 'number' ); ?>deg);">
<div class="item item-<?php echo $counter; ?>" data-rel="<?php echo the_sub_field( 'number' ); ?>" style="transform: rotate(<?php echo the_sub_field( 'number' ); ?>deg);"></div>
</div>
<?php $counter++;
endwhile; ?>
<?php endif; ?>
<div class="center"></div>
</div>
</div>
</div>
Here's the CSS:
.donut-chart-block {
overflow: hidden;
}
.donut-chart {
position: relative;
width: 200px;
height: 200px;
margin: 0px;
border-radius: 100%;
margin-left: auto;
margin-right: auto;
}
.donut-chart .center {
background: white;
position: absolute;
top: 50px;
left: 50px;
height: 100px;
width: 100px;
border-radius: 70px;
}
.clip {
border-radius: 50%;
clip: rect(0px, 200px, 200px, 100px);
height: 100%;
position: absolute;
width: 100%;
}
.item {
border-radius: 50%;
clip: rect(0px, 100px, 200px, 0px);
height: 100%;
position: absolute;
width: 100%;
font-family: monospace;
font-size: 1.5rem;
}
.donut-chart .item-1 {
background-color: #178c8e;
}
.donut-chart .item-2 {
background-color: #1e5eaa;
}
.donut-chart .item-3 {
background-color: #eac947;
}
.donut-chart .item-4 {
background-color: #143753;
}
.donut-chart .item-5 {
background-color: #0faeb1;
}
Your first clip is set to 0deg rotation. However, 0 degrees on a pie chart has 0 width. Zero = Zero so you will want to change the first clip to a positive number. Then you will need to adjust the rest accordingly.
You made mistakes in calculations. You must rotate correctly.
.donut-chart-block {
overflow: hidden;
}
.donut-chart {
position: relative;
width: 200px;
height: 200px;
margin: 0px;
border-radius: 100%;
margin-left: auto;
margin-right: auto;
}
.donut-chart .center {
background: white;
position: absolute;
top: 50px;
left: 50px;
height: 100px;
width: 100px;
border-radius: 70px;
}
.clip {
border-radius: 50%;
clip: rect(0px, 200px, 200px, 100px);
height: 100%;
position: absolute;
width: 100%;
}
.item {
border-radius: 50%;
clip: rect(0px, 100px, 200px, 0px);
height: 100%;
position: absolute;
width: 100%;
font-family: monospace;
font-size: 1.5rem;
}
.donut-chart .item-1 {
background-color: #178c8e;
}
.donut-chart .item-2 {
background-color: #1e5eaa;
}
.donut-chart .item-3 {
background-color: #eac947;
}
.donut-chart .item-4 {
background-color: #143753;
}
.donut-chart .item-5 {
background-color: #0faeb1;
}
<div class="container">
<div class="donut-chart-block block">
<div class="donut-chart">
<div class="clip clip-1" style="transform: rotate(0deg);">
<div class="item item-1" data-rel="90" style="transform: rotate(90deg);"></div>
</div>
<div class="clip clip-2" style="transform: rotate(90deg);">
<div class="item item-2" data-rel="180" style="transform: rotate(90deg);"></div>
</div>
<div class="clip clip-3" style="transform: rotate(270deg);">
<div class="item item-3" data-rel="270" style="transform: rotate(90deg);"></div>
</div>
<div class="clip clip-4" style="transform: rotate(180deg);">
<div class="item item-4" data-rel="360" style="transform: rotate(90deg);"></div>
</div>
<div class="center"></div>
</div>
</div>
</div>
<!-- begin snippet: js hide: false console: true babel: false -->
So Im working on a project for a client and ran into an issue with Border-Radius + Bootstrap,
<div class="header">
<div class="top-nav">
<div class="container">
<div class="row">
<img class="logo" src="<?php if($custom_logo){echo $custom_logo; }else{echo $avatar;} ?>">
<nav class="social-media-top">
<h1 class="col-xs-12">Hello, I am <span><?php echo $twitch_username; ?></span></h1>
<?php if($twitch_username){ ?>
<li><i class="fa fa-twitch"></i></li>
This is after adding bootstrap to make it more responsive on mobile, well after doing that this is what the top now looks like;
This is what it looks like when I remove the Bootstrap code;
This is the code with out bootstrap on the image
<div class="header">
<div class="top-nav">
<div class="container">
<div class="row">
<img class="logo" src="<?php if($custom_logo){echo $custom_logo; }else{echo $avatar;} ?>">
<nav class="social-media-top">
<h1 class="col-xs-12">Hello, I am <span><?php echo $twitch_username; ?></span></h1>
<?php if($twitch_username){ ?>
<li><i class="fa fa-twitch"></i></li>
This is my css
/* Top Header */
.header {
padding-top: 1.5em;
border-top: solid .3em rgba(46, 204, 113, 1.0);
}
.top-nav {
margin-top: 1.2em;
margin-right: auto;
margin-bottom: .8em;
margin-left: auto;
width: 30em;
}
.logo {
float: left;
width: 5em;
height: 5em;
border: solid .1em rgba(46, 204, 113, 1.0);
border-radius: 50%;
}
.social-media-top {
float: right;
padding-bottom: 1em;
}
.social-media-top h1 {
margin: 0;
padding: 0;
color: #41eb71;
font-weight: 100;
font-size: 2em;
align-content: center;
}
.social-media-top h1 span {
color: #41eb71;
text-transform: capitalize;
font-weight: 600;
}
.social-media-top li {
display: inline-block;
}
.social-media-top li i {
display: inline-block;
width: 2em;
height: 2em;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background-color: rgba(46, 204, 113, 1.0);
color: white;
text-align: center;
line-height: 2em;
}
I'm building a website with a CSS popup inside a loop that increments by 1, but the variable $i does not carry on the popup.
CSS
#cover {
position: fixed;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.6);
z-index: 5;
width: 100%;
height: 100%;
display: none;
}
#score {
height: 380px;
min-width: 280px;
max-width: 380px;
margin: 0 auto;
position: relative;
z-index: 10;
display: none;
background: url(login.png) no-repeat;
border: 5px solid #cccccc;
border-radius: 10px;
}
#score:target,
#score:target + #cover {
display: block;
opacity: 2;
}
.cancel {
display: block;
position: absolute;
top: 3px;
right: 2px;
background: rgb(245, 245, 245);
color: black;
height: 30px;
width: 35px;
font-size: 30px;
text-decoration: none;
text-align: center;
font-weight: bold;
}
.popup {
position: fixed;
left: 50%;
top: 20%;
}
.popup .wrapper {
position: relative;
left: -50%;
}
PHP
<?php $loopvalue = 3; $i=1; while ($i <= $loopvalue) {?>
<li>open popup <?php echo $i;?></li>
<div class="popup">
<div class="wrapper">
<div id="score" style="background-color:#FFF;">
popup # <?php echo $i;?>
×
</div>
<div id="cover" >
</div>
</div>
</div>
The popup number $i never changes. It freezes on 1. I'm not sure what's the problem. I don't see any, but I can't make the popup number change.
In your codes you have repeated the score div with same id. it need to have different ids for different divs
(This will only create proper html. for popup effect it needs to use some java script/JQuery codes)
Try this
<?php $loopvalue = 3; $i=1; while ($i <= $loopvalue) {?>
<li>open popup <?php echo $i;?></li>
<div class="popup">
<div class="wrapper">
<div id="score<?php echo $i;?>" style="background-color:#FFF;">
popup # <?php echo $i;?>
×
</div>
<div id="cover" > </div>
</div>
</div>
<?php $i++;}?>
i want my div to be of 100% height
HTML & CSS codes
HTML
<div>
<div class="content-box news-box" style="float: right">news section</div>
<div class="content-box slider-box" style="height: 150px;">slider box</div>
<div class="content-box plan-box">plan box</div>
<div class="clr"></div>
</div>
CSS
.content-box{
background-color: #d54515;
border-radius: 2px;
}
.news-box{
width: 19.5%;
height: 100%;
}
.slider-box{
width: 79%;
}
.plan-box{
width: 79%;
margin-top: 20px;
}
Add position:absolute; right:0 to .news-box and position:relative to parent div
Remove floats
.wrapper{
border:solid green 1px;
position:relative
}
.content-box{
background-color: #d54515;
border-radius: 2px;
height: height: 100%;
}
.news-box{
width: 19.5%;
height: 100%;
position:absolute;
right:0
}
.slider-box{
width: 79%;
}
.plan-box{
width: 79%;
margin-top: 20px;
}
DEMO
Just add a Height on your div container :
<div class="container">
<div class="content-box news-box" style="float: right">news section</div>
<div class="content-box slider-box" style="height: 150px;">slider box</div>
<div class="content-box plan-box">plan box</div>
<div class="clr"></div>
</div>
And CSS Code :
.content-box{
background-color: #d54515;
border-radius: 2px;
border: 1px #000 solid;
}
.container{
height: 200px;
}
.news-box{
width: 19.5%;
height: 100%;
}
.slider-box{
width: 79%;
}
.plan-box{
width: 79%;
margin-top: 20px;
}
Demo : http://jsfiddle.net/xkZ49/