Spans do not rotate when using mPDF - mpdf

$css = '
<style>
* {
margin: 0;
padding: 0;
}
div.titulos {
height: 200px;
background-color: #CCC;
}
div.registros {
height: 30px;
border-top: none;
}
div.titulos,
div.registros {
width: 870px;
margin: 0 auto;
border: thin solid #000;
}
div.titulos div,
div.registros div {
float: left;
text-align: center;
vertical-align: middle;
border-left: thin solid #000;
}
div.titulos div:nth-child(1),
div.registros div:nth-child(1) {
border-left: none;
}
span {}
span.normal {}
span.rotate {
height: 200px;
rotate : -90;
text-rotate : -90;
writing-mode: vertical-rl;
transform: rotate(180deg);
transform-origin: center;
}
</style>
';
$body = '
<div class="titulos">
<div style="width: 100px;"><span class=normal>Nome do Gcéu</span></div>
<div style="width: 100px;"><span class=rotate>Supervisor</span></div>
<div style="width: 100px;"><span class=normal>Líder</span></div>
<div style="width: 050px;"><span class=rotate>Houve Supervisão?</span></div>
<div style="width: 050px;"><span class=rotate>Houve dia de Jejum?</span></div>
<div style="width: 050px;"><span class=rotate>Houve dia de Evangelismo?</span></div>
<div style="width: 050px;"><span class=rotate>Membros Compromissados</span></div>
<div style="width: 050px;"><span class=rotate>Visitantes</span></div>
<div style="width: 050px;"><span class=rotate>Crianças de 0 a 12 anos</span></div>
<div style="width: 050px;"><span class=rotate>Total de presentes</span></div>
<div style="width: 050px;"><span class=rotate>Ofertas</span></div>
<div style="width: 050px;"><span class=rotate>Discipulados</span></div>
<div style="width: 050px;"><span class=rotate>Número de decisões</span></div>
</div>
<div class="registros">
<div style="width: 100px;">Gceú</div>
<div style="width: 100px;">Carlos</div>
<div style="width: 100px;">Cleo</div>
<div style="width: 050px;">Sim</div>
<div style="width: 050px;">Sim</div>
<div style="width: 050px;">Não</div>
<div style="width: 050px;">12</div>
<div style="width: 050px;">3</div>
<div style="width: 050px;">3</div>
<div style="width: 050px;">18</div>
<div style="width: 050px;">12.3</div>
<div style="width: 050px;">2</div>
<div style="width: 050px;">1</div>
</div>
';
//echo $css.$body;
require 'vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$mpdf->SetDisplayMode( 'fullpage' );
$mpdf->WriteHTML( $css, 1 );
$mpdf->WriteHTML( $body );
$mpdf->Output();
The code does not output correctly when output to PDF.
Here is an example screenshot of the PDF output:
Note that the span's class=rotate, but is not rotating. What can I change to fix this?
I need it works because it will be pressed when shown in the browser.
I've tried it with rotate : -90;, text-rotate : -90;, writing-mode: vertical-rl;, transform: rotate(180deg);, but none of these work. Why is that?

Property text-rotate is only supported for tr, th and th elements in mPDF.
transform: rotate is only supported on img element.
Also see supported CSS documentation.

Related

Two child components in parent div (flex row) always at the same height in angular 10

disclaimer: sorry if my answer is somwhere in stackoverflow... Did not find and starting being a little frustrating...
I'm working with Angular 10 and in my app.component.html, have this snippet :
<div class="chats">
<app-friend-chat *ngFor="let friend of friends" [inputFriend]="friend" (close)="closeChat($event)">
</app-friend-chat>
<app-friend-list (friend)="openChat($event)"></app-friend-list>
</div>
The component app-friend-chat is dynamic and at the started time of the site, there is no instances of it so only app-friend-list is display.
Here is the css of app.component.css :
app-friend-chat{
position: relative;
margin: 0 !important;
width: 50vh;
}
.chats{
position: absolute;
bottom: 0;
right: 5px;
z-index: 9999;
display: flex;
flex-direction: row;
}
The thing is app-friend-list's height is moving up to creation of a new app-chat-friend's instance.
When closing all app-chat-friend's instances, app-friend-list get height back to its first value.
I want my app-friend-list keep its height.
Here is app-friench-chat'html :
<div *ngIf="friend">
<div class="chatHead" fxLayout="row" fxLayoutGap="5px">
<p class="friend">{{ friend.name }}</p>
<span fxFlex="auto" (click)="minimize()"></span>
<p class="close" (click)="closeChat(friend.name)">X</p>
</div>
<div *ngIf="!mini">
<div id="messages-box">
<div *ngFor="let message of messages" class="message">
<div [ngClass]="classForParagraphe(message)" class="paragraphe"
[innerHTML]="sanitizer.bypassSecurityTrustHtml(message.message)">
</div>
<div *ngIf="user.name === message.user" class="trash">
<span class="far fa-trash-alt" (click)="deleteMessage(message)"></span>
</div>
</div>
</div>
<emoji-mart class="emoji-mart" *ngIf="isEmojiPickerVisible" (emojiSelect)="addEmoji($event)"></emoji-mart>
<div fxLayout="row" fxLayoutGap="15px">
<div class="container">
<input [(ngModel)]="message" type="text" #input (keyup)="enter($event)" />
<button (click)="isEmojiPickerVisible = !isEmojiPickerVisible;">😀</button>
</div>
<button (click)="sendMessage()">
<svg width="20px" height="20px" viewBox="0 0 24 24">
<path
d="M16.6915026,12.4744748 L3.50612381,13.2599618 C3.19218622,13.2599618 3.03521743,13.4170592 3.03521743,13.5741566 L1.15159189,20.0151496 C0.8376543,20.8006365 0.99,21.89 1.77946707,22.52 C2.41,22.99 3.50612381,23.1 4.13399899,22.8429026 L21.714504,14.0454487 C22.6563168,13.5741566 23.1272231,12.6315722 22.9702544,11.6889879 C22.8132856,11.0605983 22.3423792,10.4322088 21.714504,10.118014 L4.13399899,1.16346272 C3.34915502,0.9 2.40734225,1.00636533 1.77946707,1.4776575 C0.994623095,2.10604706 0.8376543,3.0486314 1.15159189,3.99121575 L3.03521743,10.4322088 C3.03521743,10.5893061 3.34915502,10.7464035 3.50612381,10.7464035 L16.6915026,11.5318905 C16.6915026,11.5318905 17.1624089,11.5318905 17.1624089,12.0031827 C17.1624089,12.4744748 16.6915026,12.4744748 16.6915026,12.4744748 Z">
</path>
</svg>
</button>
</div>
</div>
</div>
And css :
.chatHead {
background: rgb(210, 206, 206);
border-radius: 10px;
height: 5vh;
}
#messages-box {
height: 45vh;
background-color: white;
padding-left: 0;
overflow-y: scroll;
}
app-friend-list'html:
<div *ngIf="user && user.name !== undefined">
<h6 (click)="showList()">Discussions</h6>
<div class="list" *ngIf="show">
<ul *ngFor="let ami of user.amis">
<li (click)="addChat(ami)">{{ ami }}</li>
</ul>
</div>
</div>
app-friend-list'css:
h6{
padding: 10px;
border: solid 1px black;
height: 5.5vh;
}
ul {
padding-right: 20px;
}
li {
list-style: none;
cursor: pointer;
}
I give you only relevant code (according to me).
The other probleme I can't get ride of is that when clicking on chatHead of app-friend-chat for minimize, the component get same size of app-friend-list and so let empty space at the bottom which is very dirty (should get only size of head part)
Feel free to ask me any code I forgot to give you.

align a css timeline component for dynamic data rendering

I am trying to build a timeline component, so the timeline component has majorly 4 components.
A cirlce
A dotted line
left side details
right side details
so i am able to add these components, but how to align this so that can be use based on the dynamic data supplied. The text should be there in the left and right side of each circle.
codesandbox
sample design
I suggest you create your "TimelineEvent" components so they include both the data and the info regarding each event (and receive them as props, obviously).
I'd use a table to keep the rows aligned vertically:
#wrapper {
display: inline-block;
}
table {
border-collapse: collapse;
}
.timeline-event {
height: 100px;
}
.timeline-event:first-of-type .timeline-dash {
top: 50%;
height: 50%;
}
.timeline-event:last-of-type .timeline-dash {
height: 50%;
}
.middle-cell {
position: relative;
}
.circle-wrapper {
position: relative;
width: 20px;
}
.circle {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 20px;
height: 20px;
background-color: tomato;
border-radius: 100%;
z-index: 2;
}
.timeline-dash {
position: absolute;
width: 50%;
height: 100%;
top: 0;
border-right: 1px solid black;
z-index: 1;
}
<div id="wrapper">
<table>
<tr class="timeline-event">
<td class="data">
Event Data<br/>
Second Row
</td>
<td class="middle-cell">
<div class="circle-wrapper">
<div class="circle"></div>
</div>
<div class="timeline-dash"></div>
</td>
<td class="info">
Event Info
</td>
</tr>
<tr class="timeline-event">
<td class="data">
Event Data<br/>
Second Row<br/>
Third Row
</td>
<td class="middle-cell">
<div class="circle-wrapper">
<div class="circle"></div>
</div>
<div class="timeline-dash"></div>
</td>
<td class="info">
Event Info
</td>
</tr>
<tr class="timeline-event">
<td class="data">
Event Data<br/> Second Row<br/> Third Row
</td>
<td class="middle-cell">
<div class="circle-wrapper">
<div class="circle"></div>
</div>
<div class="timeline-dash"></div>
</td>
<td class="info">
Event Info
</td>
</tr>
</table>
</div>

bootstrap col jumping out of container

I am working on a single page app using AngularJS. I scaffolded my project using yeoman's angular generator, I'm using bootstrap-sass-official and compass.
I have some angular ng-repeat generated content which I placed inside bootstrap's col-xs-4 divs. There are three divs in a single row, and the third one (the one that contains a phone number), spills over the edge of it's container. I don't know why that happens and how to fix it.
my html:
<div class="panel-heading">kontakt</div>
<div class="panel-content contact">
<div class="container" ng-repeat="contact in contacts">
<div class="col-xs-4">
<p class="name-text">{{ contact.name }}</p>
</div>
<div class="col-xs-4">
<p class="email-text">
<a href="mailto:{{ contact.email }}">
<span class="glyphicon glyphicon-envelope email-icon"></span>
<span class="email-sign">{{contact.email}}</span>
</a>
</p>
</div>
<div class="col-xs-4">
<p class="phone-text">
<span class="glyphicon glyphicon-phone-alt phone-icon"></span>
<span class="phone-sign">{{ contact.phone }}</span>
</p>
</div>
</div>
</div>
my css:
/********************************
PANELS
********************************/
.panel-heading {
background-color: $secondary-color;
text-align: center;
font-weight: 600;
font-size: 1.2em;
margin: 0;
padding: 0.5em;
#include breakpoint(desktop) {
border-radius: 10px;
}
}
.panel-content {
background-color: #fff;
margin: 0 2.5%;
padding: 1em 0;
font-size: 1.2em;
/********************************
SPECIFIC PANELS STYLES-LOCATION
********************************/
&.location {
p {
text-align: center;
margin: 0 0 1em 0;
}
.map-container {
background-color: red;
margin: 0 auto;
width: 80%;
height: 10em;
#include breakpoint(tablet) {
height: 15em;
}
#include breakpoint(desktop) {
height: 20em;
}
}
}
/********************************
SPECIFIC PANELS STYLES-CONTACT
********************************/
&.contact {
p {
margin: 0;
padding: 0;
&.email-text {
margin: 0 auto;
}
}
.phone-text {
text-align: right;
}
.email-sign, .phone-sign {
font-size: 0.7em;
#include breakpoint(tablet) {
font-size: 1em;
}
}
.email-icon, .phone-icon {
color: #fff;
background-color: $secondary-color;
padding: 0.5em;
border-radius: 90px;
}
}
/********************************
SPECIFIC PANELS STYLES-HOURS
********************************/
&.delovni-cas {
text-align: center;
}
}
my controller:
'use strict';
angular.module('angularApp')
.controller('LandingController', function ($scope) {
$scope.contacts = [
{
name: 'informacije:',
email: 'knjiznica#ijs.si',
phone: '+386 01 4773 304'
},
{
name: 'izposoja:',
email: 'ill#ijs.si',
phone: '+386 01 4773 304'
},
{
name: 'bibliografije:',
email: 'branka.strancar#ijs.si',
phone: '+386 01 4773 247'
},
{
name: 'vodja knjižnice:',
email: 'luka.sustersic#ijs.si',
phone: '+386 01 4773 258'
}
];
});
I tried narrowing this down as much as I can. If you need more info, here is a github repo of the project (relevant files are in the app folder, under views there's landing.html, and under styles _landing.scss .
You need to wrap the col's inside a row.
<div class="panel-heading">kontakt</div>
<div class="panel-content contact">
<div class="container" ng-repeat="contact in contacts">
<div class="row">
<div class="col-xs-4">
<p class="name-text">{{ contact.name }}</p>
</div>
<div class="col-xs-4">
<p class="email-text">
<a href="mailto:{{ contact.email }}">
<span class="glyphicon glyphicon-envelope email-icon"></span>
<span class="email-sign">{{contact.email}}</span>
</a>
</p>
</div>
<div class="col-xs-4">
<p class="phone-text">
<span class="glyphicon glyphicon-phone-alt phone-icon"></span>
<span class="phone-sign">{{ contact.phone }}</span>
</p>
</div>
</div>
</div>
</div>

Table Cell Spacing Issues

Hi Guys I am using a table: cell-spacing layout for my website and I need some help. I have a two column website, one being the sidebar and the other containing the content. However, if I add any margins within one of the table-cell divs it moves the side bar spacing with it. I need the spacing on these two cells to be different, and I am not sure how to do so.
My code is as follows:
The CSS:
content {
width : 100%;
display : table;
margin : 0 auto;
height : 100%;
}
#side_bar, #main {
display : table-cell;
}
#side_bar {
border: 1px solid #111;
width: 13%;
background: linear-gradient(#444, #111);
}
#main {
width: 65%;
}
#contact_box {
margin-left: 30%;
margin-top: 7%;
background-color: #111;
opacity: 0.3;
width: 500px;
height: 500px;
}
The HTML:
<div id="content">
<div id="main">
<div id="contact_box">
<form method="post" id="contact_form" action="contact.php">
<p>Full Name:</p> <input type="text" size="40" id="fullname" name="fullname"><br/>
<p>Email Address:</p> <input type="text" size="40" id="email" name="email"><br/>
<p>Type of Inquiry:</p> <input type="text" size="40" id="question" name="question"><br/>
<p>Message:</p> <textarea rows="20" cols="45"></textarea><br/>
<input type="submit" style="float:right; text-transform: uppercase;" value="Send">
</form>
</div>
</div>
<div id="side_bar">
<div id="divider"><h1>News Blurb</h1></div>
<div id="news"><?php //print_news(); ?></div>
<div id="divider"><h1>Featured Games</h1></div>
<div id="featured"><?php //echo $games ?></div>
</div>
</div>
Thank you for any and all help.
Try:
#side_bar {
vertical-align:top;
}

Place tipsy in place where every div occure

Javascript:
<script type="text/javascript">
$(function() { $('.cat_name').tipsy({gravity: 's'}); });
</script>
TPL Smarty:
<div id="content_inside">
<a href="#" title="Test" id="1" class="cat_name">
<div class="box">
</div>
</a>
<a href="#" title="Test2" id="2" class="cat_name">
<div class="box">
</div>
</a>
</div><!-- content end -->
CSS:
#content_inside {
height: 500px;
width: 950px;
padding:5px;
}
.box {
width: 300px;
height: 261px;
padding: 5px;
float: left;
}
.box {
margin: auto;
background: url(../images/box1.jpg) no-repeat top left;
}
I need to place tipsy in upper center of every div link, how to do that?, for now tipsy are shown always at left side. Example of how is, and how need to be in img: http://oi43.tinypic.com/adka3t.jpg
There is an offset options in tipsy, which offsets from the elements.
$('.cat_name').tipsy({gravity: 's', offset: 20 });
Unfortunately, your float: left is causing tipsy to calculate the offset incorrectly. Are you able to lay out your page any differently? As an example, the following boring old tables layout seems to replicate what you're looking for designwise, as well as having the tooltips show up where you want them.
HTML:
<div id="content_inside">
<table>
<tr>
<td class="box">lkjoijkj lj lkj oij oi</td>
<td class="box">lkjoijkj lj lkj oij oi</td>
</tr>
</table>
</div>
CSS:
#content_inside {
height: 500px;
width: 950px;
padding:5px;
}
.box {
width: 300px;
height: 261px;
padding: 5px;
}
a {
display:block;
height: 100%;
}

Resources