Span acting like div - html

I have this code, where I planned to have three spans side by side displaying the step a person is at signing up for my website. However, the spans are acting like divs and going onto the next line. I have no idea why this is happening. To my understanding, the spans should only take up the width they need, not an entire line
<div class="row stepRow">
<div class="col-12-md ">
<div id="stepDisplay">
<span class="stepBlock">
<h3 class="headerStep">Step 1</h3>
<p class="descStep">Basic Details</p>
</span>
<span class="stepBlock">
<h3 class="headerStep">Step 2</h3>
<p class="descStep">More Details</p>
</span>
<span class="stepBlock">
<h3 class="headerStep">Step 3</h3>
<p class="descStep">Payment Details</p>
</span>
</div>
</div>
</div>
//in seperate css file
.stepBlock {
display: display;
text-align: center;
}
.headerStep .descStep {
display: inline;
}

You missed the comma(,) between .headerStep and .descStep. It should be like following.
.headerStep, .descStep {
display: inline;
}

Because you are using h3 element inside span which takes all available width. Either replace h3 or set its maximum length

Here is the solution you are looking for
<div class="row stepRow">
<div class="col-12-md ">
<div id="stepDisplay">
<span class="stepBlock">
<h3 class="headerStep">Step 1</h3>
<p class="descStep">Basic Details</p>
</span>
<span class="stepBlock">
<h3 class="headerStep">Step 2</h3>
<p class="descStep">More Details</p>
</span>
<span class="stepBlock">
<h3 class="headerStep">Step 3</h3>
<p class="descStep">Payment Details</p>
</span>
</div>
</div>
CSS Code
.stepBlock {
display: display;
text-align: center;
}
.headerStep .descStep {
display: inline;
}
h3,p {
display:inline;
}

Try this: jsfiddle
.stepBlock {
display: inline-block;
text-align: center;
width: 30%;
}
.headerStep, .descStep {
display: block;
}

Related

Setting position of custom slider controls (CSS)

I've been making my anime website where people can watch anime for free with subtitles (Bulgarian subtitles, since I'm from Bulgaria). Now I'm remaking it from scratch because I have been using a theme but It didn't have much functionality... Now I'm making the slider for the recently added animes but I want it to be a custom one so I'm making.... the slider controls are not in a position, so I tried with float, flex with float, etc.... Here's a picture where it should belong: click to open the image (important)
Here's the HTML:
<div class="recent-anime">
<!-- Title and Controls -->
<div class="title-controls">
<h1 class="title">Наскоро добавни</h1>
<a><i class="fas fa-angle-left"></i></a>
<a><i class="fas fa-angle-right"></i></a>
</div>
<!-- Anime cards -->
<div class="animecards">
<div class="animecard">
<img src="images/cover.png">
<div class="ani">
<p class="anititle">Anime title</p>
<p class="aniepisode">Episode</p>
</div>
</div>
<div class="animecard ml">
<img src="images/cover.png">
<div class="ani">
<p class="anititle">Anime title</p>
<p class="aniepisode">Episode</p>
</div>
</div>
<div class="animecard ml">
<img src="images/cover.png">
<div class="ani">
<p class="anititle">Anime title</p>
<p class="aniepisode">Episode</p>
</div>
</div>
<div class="animecard ml">
<img src="images/cover.png">
<div class="ani">
<p class="anititle">Anime title</p>
<p class="aniepisode">Episode</p>
</div>
</div>
<div class="animecard ml">
<img src="images/cover.png">
<div class="ani">
<p class="anititle">Anime title</p>
<p class="aniepisode">Episode</p>
</div>
</div>
<div class="animecard ml">
<img src="images/cover.png">
<div class="ani">
<p class="anititle">Anime title</p>
<p class="aniepisode">Episode</p>
</div>
</div>
</div>
</div>
And the CSS:
.title-controls {
display: flex;
flex-direction: row;
font-size: 42px;
margin-bottom: 10px;
}
.title {
font-size: 26px;
}
.animecards {
display: flex;
}
.animecard {
display: block;
float: left;
}
.animecard img {
max-height: 325px;
}
.ml {
margin-left: 15px;
}
.ani {
text-align: center;
}
There's no JS. Still on the HTML and CSS part.
NOTE: This is clean CSS!
justify-content: space-between; on title-controls class will solve the issue shown in image
.title-controls {
display: flex;
flex-direction: row;
font-size: 42px;
margin-bottom: 10px;
justify-content: space-between;
}

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>

Children of table-cell bootstrap columns not occupying full height

I have 3 different account cards with varying content in each card. I want all the cards (which reside inside a col-md-4 class) to occupy the full height of the column.
I gathered from [this][1] thread that one way to achieve that is to use display: table. The main issue is that I have a div inside the my columns which I need to occupy the full height of the column. I set those divs to display: inline-block and height to 100% but divs seem to be behaving as if height was set to auto and not occupying full height
Here is my html:
.container {
display: table;
}
.row {
display: table-row;
height: 100%;
}
.col-md-4 {
display: table-cell;
float: none;
height: 100%;
}
.account {
background: $overlay-color;
text-align: center;
display: inline-block;
margin: 0;
padding: 0;
height: 100%;
}
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="account">
<h1 class="type">MINI ACCOUNT</h1>
<div class="details">
<h2 class="ad">A perfect account to start with!</h2>
<p class="detail">Spreads from 2.3 pips</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="account">
<h1 class="type">STANDARD ACCOUNT</h1>
<div class="details">
<h2 class="ad">An ideal account for every investor!</h2>
<p class="detail">Spreads from 1.9 pips</p>
<p class="detail">Minimum deposit = $25 000</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="account">
<h1 class="type">EXCLUSIVE ACCOUNT</h1>
<div class="details">
<h2 class="ad">An exclusive account for exclusive clients!</h2>
<p class="detail">Spreads from 0 pips</p>
<p class="detail">Minimum deposit = $50,000</p>
<p class="detail">Access to Daily Technical Analysis</p>
</div>
</div>
</div>
</div>
</div>
Try with flexbox
.container {
display: table;
}
.row {
display: flex;
}
.col-md-4 {
float: none;
}
.account {
background: rgba(0, 0, 0, 0.34);
text-align: center;
display: inline-block;
margin: 0;
padding: 0;
height: 100%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="account">
<h1 class="type">MINI ACCOUNT</h1>
<div class="details">
<h2 class="ad">A perfect account to start with!</h2>
<p class="detail">Spreads from 2.3 pips</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="account">
<h1 class="type">STANDARD ACCOUNT</h1>
<div class="details">
<h2 class="ad">An ideal account for every investor!</h2>
<p class="detail">Spreads from 1.9 pips</p>
<p class="detail">Minimum deposit = $25 000</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="account">
<h1 class="type">EXCLUSIVE ACCOUNT</h1>
<div class="details">
<h2 class="ad">An exclusive account for exclusive clients!</h2>
<p class="detail">Spreads from 0 pips</p>
<p class="detail">Minimum deposit = $50,000</p>
<p class="detail">Access to Daily Technical Analysis</p>
</div>
</div>
</div>
</div>
</div>

How can I get my content centered in this responsive div?

I have 4 columns in a row that become 1 column on mobile. The way this looks on mobile is fine, but I want to center the content in divs 2 and 4 in each row. What would be the best way to do this?
Apparently my edit was deleted or the site messed up, but I had said I want to do this vertical and horizontal. However, it was my fault I forgot to link to the page. Sorry, guys. - http://www.dismantledesign.com/testsite2/clients.html
Edit: I appreciate all the answers, but I don't think anyone understands that this div has no set height. I just want that text and icons to stay centered as the screen moves. The flex didn't seem to work because it required setting a height to the div.
I also simplified my HTML
Code
.clientsdetail {
text-align: center;
margin: 0px;
padding: 0px;
overflow-x: hidden;
}
.clientinfo h3 {
padding-top: 10px;;
}
.clientinfo p {
padding: 0px 30px;
font-size: 15px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-md-3 nopadding">
<img class="img-responsive" src="img/clients/ivey.jpg">
</div>
<div class="col-md-3 nopadding cinfo">
<div class="clientinfo text-center">
<h3>IVEY</h3>
<p>Clarksville, TN</p>
<div class="social-icons-clients">
<span class="icon-sprite sprite-ig"> </span>
<span class="icon-sprite sprite-fb"> </span>
<span class="icon-sprite sprite-gp"> </span>
<span class="icon-sprite sprite-sc"> </span>
<span class="icon-sprite sprite-tw"> </span>
</div>
</div>
</div>
<div class="col-md-3 nopadding cinfo">
<img class="img-responsive" src="img/clients/rufus.jpg">
</div>
<div class="col-md-3 nopadding">
<div class="clientinfo text-center">
<h3>RUFUS DAWKINS</h3>
<p>Clarksville, TN</p>
<div class="social-icons-clients">
<span class="icon-sprite sprite-ig"> </span>
<span class="icon-sprite sprite-fb"> </span>
<span class="icon-sprite sprite-gp"> </span>
<span class="icon-sprite sprite-sc"> </span>
<span class="icon-sprite sprite-tw"> </span>
</div>
</div>
</div>
</div>
You can use flex properties to make your content to center.
for more details, you can check
Flexbox: center horizontally and vertically
(UPDATED)
You can use the Pseudoclass to select the 2 and 4 div.
.row div:nth-child(2n) {
/* Your CSS Style */
}
If the content inside the 2 and 4 div are inline/inline-block, just use text-align: center;.
Demo
Here is the simple demo for the pseudoclass.
.row > div {
padding: 10px;
}
.row > div:nth-child(2n) {
color: #fff;
background: red;
text-align: center;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
}
<div class="row">
<div>One</div>
<div>Two</div>
<div>Three</div>
<div>Four</div>
</div>
Hope this is helpful for you.
Thanks.
Try a different approach. Bootstrap's floating grid system will not get you where you want.
First, remove row and col- classes so you have something like this:
<div class="my-row">
<div></div>
<div></div>
<div></div>
</div>
Then use CSS to achieve the same result as before, but with the content aligned center:
#media (min-width: 992px) {
.my-row {
display: flex;
align-items: stretch;
}
.my-row > div {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
}
}
If you are using SASS, then replace hardcoded 992px with the #screen-md-min variable.
Here's a JsFiddle of your simplified example:
https://jsfiddle.net/mpnz9b30/1/
<div class="col-md-6 nopadding cinfo">
<div class="clientinfo">
<h3>IVEY</h3>
<p>Clarksville, TN</p>
<div class="social-icons-clients">
<span class="icon-sprite sprite-ig"> </span>
<span class="icon-sprite sprite-fb"> </span>
<span class="icon-sprite sprite-gp"> </span>
<span class="icon-sprite sprite-sc"> </span>
<a href="https://twitter.com/contracoda" target="_blank">
<span class="icon-sprite sprite-tw"> </span>
</a>
</div>
</div>
</div>

How to align a text below a picture at the center of the div horizontally

I am making my pageresponsive for the screen size (max-width: 991px) to (min-width: 768px). Here i have a picture and some text below it i want it be aligned horizontally at the center:-
<div class="col-lg-2 pictures_titles" >
<img class="team_img" src="../assets/img/Website-Png/About-Us-01-3.png">
<br><br>
<div class="name_titles">
<span id="namess" style="color:white;"><p> JAMES WILLIAMS </p></span>
<br>
<span id="storys1" style="color:white;">
<p> An experienced strategist and entrepreneur, he is the Founder and Managing Director
of gorb.</p> </span>
</div>
</div>
text-align: center will center text and inline elements
Note, it is not allowed with p elements inside span, so I changed span to div
.pictures_titles {
background: gray;
text-align: center;
}
<div class="col-lg-2 pictures_titles">
<img class="team_img" src="http://placehold.it/300x150">
<br><br>
<div class="name_titles">
<div id="namess" style="color:white;">
<p> JAMES WILLIAMS </p>
</div>
<br>
<div id="storys1" style="color:white;">
<p> An experienced strategist and entrepreneur, he is the Founder and Managing Director of gorb.</p>
</div>
</div>
</div>
If you want the text to be within the boundaries of the image, you could do like this, using display: table-caption
body {
background: gray;
}
.pictures_titles {
display: table;
margin: 0 auto;
text-align: center;
}
.name_titles {
display: table-caption;
}
<div class="col-lg-2 pictures_titles">
<div class="name_titles">
<img class="team_img" src="http://placehold.it/300x150">
<br><br>
<div id="namess" style="color:white;">
<p> JAMES WILLIAMS </p>
</div>
<br>
<div id="storys1" style="color:white;">
<p> An experienced strategist and entrepreneur, he is the Founder and Managing Director of gorb.</p>
</div>
</div>
</div>
Well, you could easily do that with CSS of course.
.name_titles {
text-align:center;
}
If you want to make image at center and text below it also aligned to center then use-
<div class="col-lg-2 pictures_titles" style="text-align:center;">
<img class="team_img" src="../assets/img/Website-Png/About-Us-01-3.png">
<br><br>
<div class="name_titles">
<span id="namess" style="color:white;"><p> JAMES WILLIAMS </p></span>
<br>
<div id="storys1" style="color:white;">
<p> An experienced strategist and entrepreneur, he is the Founder and Managing Director
of gorb.</p> </div>
</div>
</div>