How do you make a responsive footer like this? - html

I want to make the footer look like this in Desktop:
In mobile it should look like this:
I tried the following, but the text seems to go out of bounds (note this is just one of my prototypes, you would get overwhelmed if I posted all of them here):
<div class="row">
<div class="footercol1" style="line-height:10px;display: flex;">
<div id="image" style="float: left; margin-left: 25px;">
<img src="https://picsum.photos/200/200" width="73" />
</div>
<div class="col-sm-6" style="word-wrap:normal;max-width:300px;width:50%;float: right; margin-left: 10px;">
<p style="font-size: 14px;">Text1 blablablablablablablabla</br>
</br>
blablablablablablablablablablablablablablabla</br>
</br>
blablablablablablalblalbblalblbalblbalblalblbabla<br /> <br /> blablablablabalbalblablalblalbbllabllbalblabla.
</p>
</div>
<div class="col-sm-6" style="max-width:300px;float: right; width:50%;margin-left: 50px;font-size: 14px;">
<strong style="color: #489523;">Text 2: </strong> blablablabalbalbalblbalblalblbalblablblalbalblblalblblalblabla <br /><br />
<p>blablablablablablabalbalbalbalblablbablalblablablablabla</p>
<br />
<img class="alignleft" src="https://picsum.photos/70/30" alt="">
</div>
</div>
</div>
FYI: footercol1 doesn't yet contain any CSS rules, hence it's not appended to the question.
UPDATE
Text out of bounds problem is also visible in your snippet as well:
UPDATE 2
Adding the following CSS rules to p:
word-break: normal;
white-space: normal;
partly solves the overflow problem, but it makes the text quite "crambed" as a side effect. Any clue how to fix that?

You're already using flex on your footercol1, so the easiest would probably be to just to use a media query to define the flex direction.
Something like:
.footercol1 {
display: flex;
}
p {
overflow-wrap: break-word;
}
#media only screen and (max-width: 600px) {
.footercol1 {
flex-direction: column;
}
}
<div class="row">
<div class="footercol1" style="line-height:10px;display: flex;">
<div id="image" style="float: left; margin-left: 25px;">
<img src="https://picsum.photos/200/200" width="73" />
</div>
<div class="col-sm-6" style="word-wrap:normal;max-width:300px;width:50%;float: right; margin-left: 10px;">
<p style="font-size: 14px;">Text1 blablablablablablablabla
<br>
<br> blablablablablablablablablablablablablablabla
<br>
<br> blablablablablablalblalbblalblbalblbalblalblbabla
<br>
<br> blablablablabalbalblablalblalbbllabllbalblabla.
</p>
</div>
<div class="col-sm-6" style="max-width:300px;float: right; width:50%;margin-left: 50px;font-size: 14px;">
<strong style="color: #489523;">Text 2: </strong> <p>blablablabalbalbalblbalblalblbalblablblalbalblblalblblalblabla</p>
<br>
<br>
<p>blablablablablablabalbalbalbalblablbablalblablablablabla</p>
<br>
<img class="alignleft" src="https://picsum.photos/70/30" alt="">
</div>
</div>
</div>
flex-direction: row; is default. You should probably read up on flexbox:
https://developer.mozilla.org/en-US/docs/Web/CSS/flex

Related

Make text appear to the right of a picture

<div style="float: left;">
<img src="image.png"/>
<div style="font-size: 100px;">Health And Wellbeing</div>
</div>
When I run this code, the words appear underneath the picture, is there any way to make the words appear to the right of the text?
I am not sure why your container div has float: left; in its styles, but you can use Flexbox to arrange the contents with more flexibility.
Here's a simple example:
<div style="float: left; display: flex;">
<img src="https://picsum.photos/seed/picsum/200/300" />
<div style="font-size: 100px;">Health And Wellbeing</div>
</div>
Isn't it simple? Just put <img> after the words...
<div style="float: left;">
<div style="font-size: 100px;">
Health And Wellbeing
</div>
<img src="image.png" />
</div>

HTML/CSS Report - RTL Language

I am not very expert at all when it comes to html layouts.
I am trying to generate an invoice report which looks exactly like this:
Print dimensions must be 13.9cm x 22.8 cm
but I am finding a very hard time since it's in Arabic, and Arabic is a pure nightmare in web development, and that's my first project in arabic.
I've tried pdfmake's angular library which gives a better way to produce such reports, but it does not support Arabic fonts :(!
So instead, I am trying to replicate the same layout in html/css:
which looks much uglier than the original; and it's hard to get the same page dimension on print here.
My html layout:
<div ng-if="printVar === true " style="width:13.9cm; height:22.8cm; border:1px solid black;">
<style>
.navbar-primary {
display: none !important;
}
.navbar {
display: none !important;
}
</style>
<h3 style="text-align: center"> شركة ففف فف ش.م.ل </h3>
<br>
<br>
<div style= "text-align: center;">
الدورة - شارع الضمان الاجتماعي - لبنان
هاتف: ٠١\فففف- فففف</div>
<hr>
<div style="margin:0px 30px 0px 20px; text-align: right">
<span style="float: right;">:المرجع</span> <span style="padding:20px"> {{reference}} </span> <br>
<span style="float: right;">:التاريخ</span> <span style="padding:20px"> {{datenow |date: "MM/dd/yy" }} </span> <br>
<hr>
<br>
<div style="margin:0px 30px 0px 20px; text-align: right">
<br>
<br> <span style="float: right;">رقم الشاحنة</span> <span style="padding:20px"> {{truckNumber}} </span>
<br>
<br> <span style="float: right;"> الشركة </span> <span style="padding:20px"> {{company}} </span>
<br>
<br> <span style="float: right;"> السائق </span> <span style="padding:20px">{{driverName}} </span>
<br>
<br> <span style="float: right;"> نوع البضاعة </span> <span style="padding:20px"> {{commodity}}</span>
<br>
<br> <span style="float: right;">شركة الشحن </span> <span style="padding:20px">{{freightCompany}}</span>
<br>
<br>
<br>
<div style="border:1px solid black;">
<br> <span style="float: right;"> :(الوزنة الأولى (كلغ</span> &nbsp&nbsp <span style="padding:20px"> {{firstWeight}} </span>
<br> {{firstWeightDate|date: "MM/dd/yy - hh:mm:ss"}}
<br> <br> <span style="float: right;"> :(الوزنة الثانية (كلغ </span> &nbsp&nbsp <span style="padding:20px"> {{secondWeight}} </span>
<br> {{secondWeightDate|date: "MM/dd/yy - hh:mm:ss"}}
<br>
<span style="float: right;">:الوزن الصافي </span> <span style="padding:20px"> {{secondWeight- firstWeight}} </span>
</div>
<br> <br> <br>
<div style= "width:150px; height: 110px; border:1px solid black; float:left; text-align:center; margin-right:60px" >
إمضاء المسؤول عن الموقع</div>
<div style= "width:150px; height: 110px ;border:1px solid black; float:left ;text-align:center" >
إمضاء السائق </div>
</div>
</div>
My questions:
What approach should I adopt to improve the layout and make it more similar to the original?
Is there a pdfmake alternative that supports arabic? I have tried pdfkit and jspdf and all are failing to produce arabic letters correctly, is there anyone who could make it with a rtl language with any of these libraries?
So when it comes to structuring something like this, I would recommend using either Flexbox or CSS Grid. It will handle quite a bit of the alignment on its own and, assuming your HTML is structured correctly, make a fairly good looking page.
I threw together a short example to help you get started using Flexbox. I would recommend reading up on it if this seems like the route you want to take.
h2,
h4 {
text-align: center;
}
.bordered {
border: 1px solid black;
}
.centered {
text-align: center;
display: block;
}
.container {
margin-bottom: 1em;
}
.row {
display: flex;
justify-content: space-between;
margin-bottom: 0.5em;
}
.row.right {
justify-content: flex-end;
}
.cell {
margin: 0 0.5em;
}
.expanded {
min-width: 45%;
height: 100px;
}
.sub-header {
border-left: none;
border-right: none;
padding: 0.5em 2em;
}
<div ng-if="printVar === true ">
<style>
.navbar-primary {
display: none !important;
}
.navbar {
display: none !important;
}
</style>
<h2> شركة ففف فف ش.م.ل </h2>
<h4>الدورة - شارع الضمان الاجتماعي - لبنان هاتف: ٠١\فففف- فففف</h4>
<div class="container bordered sub-header">
<div class="row">
<span class="cell"> {{datenow |date: "MM/dd/yy" }}</span>
<span class="cell">التاريخ</span>
<span class="cell">{{reference}}</span>
<span class="cell">المرجع</span>
</div>
</div>
<div class="container text-body">
<div class="row right">
<span class="cell">{{truckNumber}}</span>
<span class="cell">رقم الشاحنة</span>
</div>
<div class="row right">
<span class="cell">{{company}}</span>
<span class="cell">الشركة</span>
</div>
<div class="row right">
<span class="cell">{{driverName}}</span>
<span class="cell">السائق</span>
</div>
<div class="row right">
<span class="cell"> {{commodity}}</span>
<span class="cell">نوع البضاعة</span>
</div>
<div class="row right">
<span class="cell">{{freightCompany}}</span>
<span class="cell">شركة الشحن</span>
</div>
</div>
<div class="container bordered">
<div class="row">
<span>{{firstWeightDate|date: "MM/dd/yy - hh:mm:ss"}}</span>
<span>{{firstWeight}}</span>
<span>(الوزنة الأولى (كلغ</span>
</div>
<div class="row">
<span>{{secondWeightDate|date: "MM/dd/yy - hh:mm:ss"}}</span>
<span>{{secondWeight- firstWeight}}</span>
<span>الوزن الصافي</span>
</div>
</div>
<div class="row">
<div class="cell bordered expanded">
<span class="centered">إمضاء المسؤول عن الموقع</span>
</div>
<div class="cell bordered expanded">
<span class="centered">إمضاء السائق</span>
</div>
</div>
</div>

How to keep the text align of each other

This is the site i'm working on. http://elegantcurtainsandblinds.co.uk/
The text at the top with the icons/images (call us, visit our showroom, Watch our video), I can't seem to keep the text align of each other.
So the text should be within the same line of each other. Everytime I put space in the image/icon moves further to the left.
This is the code -
<div class="topSection">
<div class="logo">
<img src="<?php echo $siteURL;?>/images/eg_logo_new.png" alt="Logo">
</div>
<br>
<p style="float:right;"> Call Us: 01924 724848</p>
<img style="float:right;" src="images/mobile.png"/> <br><br>
<p style="float:right;"> Visit Our Showroom</p>
<img style="float:right;" src="images/images.png" height="30px" width="30px;"/><br><br>
<p style="float:right;"> Watch Our Video</p>
<img style="float:right;" src="images/video.png" height="30px" width="30px;"/>
<div class="clear"></div>
</div>
Use display: flex for modern browsers, it's mush easier to work with. Here is a possible solution for your problem (click on Run code snippet to see the result):
.topSection {
display: flex;
justify-content: space-between;
}
.info-container {
display: flex;
flex-direction: column;
}
.info {
display: flex;
align-items: center;
}
.info img {
margin-right: 8px;
}
<div class="topSection">
<div class="logo">
<img src="http://www.elegantcurtainsandblinds.co.uk/images/eg_logo_new.png" alt="Logo">
</div>
<div class="info-container">
<div class="info">
<img src="http://elegantcurtainsandblinds.co.uk/images/mobile.png" height="30px" width="30px;" />
<p>Call Us: 01924 724848</p>
</div>
<div class="info">
<img src="http://elegantcurtainsandblinds.co.uk/images/images.png" height="30px" width="30px;">
<p>Visit Our Showroom</p>
</div>
<div class="info">
<img src="http://elegantcurtainsandblinds.co.uk/images/video.png" height="30px" width="30px;">
<p>Watch Our Video</p>
</div>
</div>
</div>
More info on flexbox

How to align text in line with icons?

http://jsfiddle.net/acz3hhsL/
Code:HTML
<div id="contact-info">
<div id="adresa">
<div id="addPadding" style="padding: 2em;">
<img src="http://avocat.dac-proiect.ro/wp/wp-content/themes/twentyfourteen/images/ADRESA.png" style="width:22px;height:31px;float:left;display: inline;">
<div style="float: right;display: inline;width: 80%;">
<p style="text-align:left;font-size:14px;color:black;">Calea Dorobantilor,nr.74,<br>bl.Y9,SC.2,Ap.25<br>Cluj-Napoca,400609<br>Romania</p>
</div>
</div>
</div>
<div id="telefon">
<div id="addPadding" style="padding: 60px 2em;">
<img src="http://avocat.dac-proiect.ro/wp/wp-content/themes/twentyfourteen/images/TELEFON.png" style="width:22px;height:31px;float:left;display: inline;">
<div style="float: right;display: inline;width: 80%;">
<p style="font-size:14px;color:black;text-align:left;">Tel./Fax (004) 0264 448 579<br>Tel.(004) 0744 490 776</p>
</div>
</div>
</div>
<div id="mail">
<div id="addPadding" style="padding: 20px 2em;">
<img src="http://avocat.dac-proiect.ro/wp/wp-content/themes/twentyfourteen/images/E-MAIL.png" style="width:26px;height:19px;float:left;display: inline;">
<div style="float: right;display: inline;width: 80%;">
<p style="font-size:14px;color:black;text-align:left;">office#codoban.com</p>
</div>
</div>
</div>
</div>
</div>
Code CSS:
#contact-info
{
width:268px;
height:270px;
background:url(http://avocat.dac-proiect.ro/wp/wp-content/themes/twentyfourteen/images/BODY-CONTACT.png);
position:absolute;
right:0;
}
This is the site:
http://avocat.dac-proiect.ro/wp
I changed the text font size and unfortunately not displayed inline with icon sites.
How can I get him back but font-size:14px;
Can you help me please to solve this problem?
Thanks in advance!
Add
p {margin: 0;}
to your CSS, that removes the gaps/offset of the text. http://jsfiddle.net/acz3hhsL/2/

How do I center wells in bootstrap?

I am working on a simple homepage for my website but I want to get the well evenly spread out. I can align the left to the left and the right to the right but I cant seem to be able to get that middle well to always stay in the centre of the page. I have tried many things but they all don't work, have a look at my site to see what I want to do, the wells are under the image slider. This is the code I have done but and the CSS is the default bootstrap min css with a few tweaks for the colors.
<div class="container">
<div class="row">
<div class="col-lg-4 well" style="margin-left: 10px !important; width: 330px;
margin-right: 10px; padding: 4px !important; min-height: 330px; ">
<center>
<img style="height: 135px;" src="img/ts.png" />
<h3>TeamSpeak 3</h3>
<br />
<p>Chat with us on our TeamSpeak at: <br />
<b>ts.clustermc.net</b>
<br /> So, come have a wonderful conversation with us!</p>
</center>
</div>
<div class="col-lg-4 well" style="margin-left: 10px !important; width: 330px;
margin-right: 10px; padding: 4px !important; min-height: 330px; ">
<center>
<img style="height: 135px;" src="img/wool.png" />
<h3>Cluster MC</h3>
<div class="progress" style="margin-bottom: 7px; width: 200px;">
<div class="progress-bar progress-bar-success" style="width: 2.0%;">
</div>
<div class="progress-bar progress-bar-danger" style="width: 98.0%;">
</div>
</div>
<p style="margin-top: -27px; color: white; font-weight: bold;">
3 Online</p>
<br />
<p>Start collecting your ClusterCredits now at:<br />
<b>play.clustermc.net</b></p>
</center>
</div>
<div class="col-lg-4 well" style="margin-left: 10px !important; width: 330px;
margin-right: 10px; padding: 4px !important; min-height: 330px; ">
<center>
<img style="height: 135px;" src="img/forums.png" />
<h3>Community Forums</h3>
<br />
<p>Come and talk to some of our memers and staff at the forums! <br />
<b>www.clustermc.net/forums
</b>
<br />We dont bite, we promise!</p>
</center>
</div>
</div>
</div>
Sorry for the bad layout, im a beginner to coding and I want to learn :)
This is the Updated code.I have nested a div with class well as it was getting overlapped when used with col-lg-4. Please check the below code:
<div class="container">
<div class="row">
<div class="col-lg-4">
<div class="well" style="height: 330px; width: 330px;">
<center>
<img style="height: 135px;" src="img/ts.png"/>
<h3>TeamSpeak 3</h3>
<br/>
<p>Chat with us on our TeamSpeak at: <br/>
<b><a href="ts3server://ts.clustermc.net">
ts.clustermc.net</a></b>
<br/>
So, come have a wonderful conversation with us!
</p>
</center>
</div>
</div>
<div class="col-lg-4">
<div class="well" style="height: 330px; width: 330px;">
<center>
<img style="height: 135px;" src="img/wool.png"/>
<h3>Cluster MC</h3>
<div class="progress" style="margin-bottom: 7px; width: 200px;">
<div class="progress-bar progress-bar-success"
style="width: 2.0%;"></div>
<div class="progress-bar progress-bar-danger"
style="width: 98.0%;"></div>
</div>
<p style="margin-top: -27px; color: white; font-weight: bold;">
3 Online
</p>
<br/>
<p>Start collecting your ClusterCredits now at:<br/>
<b>play.clustermc.net</b></p>
</center>
</div>
</div>
<div class="col-lg-4">
<div class="well" style="height: 330px; width: 330px;">
<center>
<img style="height: 135px;" src="img/forums.png"/>
<h3>Community Forums</h3>
<br/>
<p>Come and talk to some of our memers and staff at the forums
<br/>
<b><a href="http://clustermc.net/forums">
www.clustermc.net/forums</a>
</b><br/>
We dont bite, we promise!</p>
</center>
</div>
</div>
</div>
</div>
It looks like your three 'well' divs are sitting in the middle of the page already?
As every thing is sitting in <div class="container"> that is the bootstrap class used to center things on a page. As per http://getbootstrap.com/2.3.2/scaffolding.html#layouts.
Note: It looks like you're missing a final ending </div> for the container class
I'm not 100% sure what issue you are having. Maybe provide a screenshot of what you want to achieve?