I used CSS property display: flex. My content div's are not equal.
right now it looks like:
I want to make it look like so:
HTML
<div class="poplar-boxes">
<div class="popular-boxes-devider"></div>
</div>
<div class="poplar-boxes">
<div class="popular-boxes-devider">
</div>
CSS
.poplar-boxes {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: stretch;
}
.popular-boxes-devider {
flex-basis: 30%
}
Here is a JS Fiddle
Your flex item are the same in height ( popular-boxes-devider ) . The problem is that you set the border to .info which are not equal in height.
The trick is to get them equal. You need to calculate their height depending on their margin top, padding and height of the round circle above them
See snippet below
/* Added styles */
.effect2,
.icon {
height: 100%;
}
.info {
height: calc(100% - 72px);
box-sizing: border-box;
}
.popular-boxes-devider {
margin-bottom: 15px;
}
/* end Added styles */
.poplar-boxes {
min-height: 100%;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.popular-boxes-devider {
flex-basis: 30%;
}
.box > .icon {
text-align: center;
position: relative;
background: #fff;
}
.box > .icon > .image {
position: relative;
z-index: 2;
margin: auto;
width: 88px;
height: 88px;
border: 4px solid white;
line-height: 88px;
border-radius: 50%;
background: #2c2c2c;
vertical-align: middle;
}
.box > .icon:hover > .image {
background: #6CB4C4;
}
.box > .icon > .image > i {
font-size: 36px !important;
color: #fff !important;
}
.box > .icon:hover > .image > i {
color: white !important;
}
.box > .icon > .info {
margin-top: -24px;
background: rgba(44, 44, 44, 0.09);
border: 1px solid #2c2c2c;
padding: 15px 0 10px 0;
}
.box > .icon:hover > .info {
background: rgba(0, 0, 0, 0.04);
border-color: #e0e0e0;
color: white;
}
.box > .icon > .info > h3.title {
font-size: 21px;
font-family: "Quicksand", sans-serif !important;
font-size: 28px;
color: #222;
font-weight: 500;
padding-top: 14px;
}
.box > .icon > .info > p {
font-size: 15px;
color: #666;
line-height: 1.5em;
margin: 20px 10px;
text-align: justify;
}
.box > .icon > .info > .more a {
font-family: "Quicksand", sans-serif !important;
font-size: 12px;
color: #222;
line-height: 12px;
text-transform: uppercase;
text-decoration: none;
}
.box > .icon:hover > .info > .more > a {
color: #fff;
padding: 6px 8px;
background-color: #63B76C;
}
/* .box .space { height: 2px; background-color: #2c2c2c;} */
.btn-default {
font-family: "Quicksand", sans-serif;
background-color: #75b1ae;
color: #FFFFFF;
}
.btn-default:hover {
background-color: #FFFFFF;
color: black;
}
.box .image img {
width: 58%;
/* vertical-align: sub; */
}
/*==================================================
* Effect 2
* ===============================================*/
.effect2 {
position: relative;
}
.effect2:before,
.effect2:after {
z-index: -1;
position: absolute;
content: "";
bottom: 13px;
left: 10px;
width: 50%;
top: 80%;
max-width: 300px;
background: #777;
box-shadow: 0 15px 10px #777;
transform: rotate(-3deg);
}
.effect2:after {
transform: rotate(3deg);
right: 10px;
left: auto;
}
<div class="poplar-boxes">
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/startup-registration.png" /></div>
<div class="info">
<h3 class="title">Startup Registration</h3>
<p>
SetyourBiz is a leading business setĀup services provider in India with 4% market share in highly unorganized sector of small scale consultants.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/foreign-investment.png" /></div>
<div class="info">
<h3 class="title">Foreign Investment (FDI)</h3>
<p>
Foreign investment is regulated by FEMA act, RBI circulars. Our expert advise and prompt services has what made us a renowned face in such sectors.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/licensing-and-registrations.png" /></div>
<div class="info">
<h3 class="title">Licensing & Registrations</h3>
<p>
It is imperative and mandatory for a start up as well as established business to obtain required licenses in order to legally operate.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/intellectual-property-rights.png" /></div>
<div class="info">
<h3 class="title">Intellectual Property Rights</h3>
<p>
Every business, invention, original creative work and design needs to be legally protected to claim the owner's right and safeguard it from infringement
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/accounting-and-tax.png" /></div>
<div class="info">
<h3 class="title">Accounting & tax</h3>
<p>
Accounting and taxes may be complex for you but it is simple for our expert team of CAs.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/secretarial-services.png" /></div>
<div class="info">
<h3 class="title">Secretarial Services</h3>
<p>
Corporate and economic laws may be cumbursome but not for our team of CS, experience excellence here.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/hr-and-legal.png" /></div>
<div class="info">
<h3 class="title">Legal Services</h3>
<p>
Reply to notices like IP Violation Notice, cheque bounce notice, NRI, Immigration Services and Drafting of Legal Documents, Agreements like vendor engagement agreement, confidentiality.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/hr-and-legal.png" /></div>
<div class="info">
<h3 class="title">Labour Laws & Payroll</h3>
<p>
Registration with Labour Department, Creation of PF / ESIC accounts and payment of dues for employees and monthly compliance of TDS are necessary compliance, rest assured with a fee of Rs. 250 per employees.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/funding-and-restructuring.png" /></div>
<div class="info">
<h3 class="title">Funding & Restructuring</h3>
<p>
Registration with Labour Department, Creation of PF / ESIC accounts and payment of dues for employees and monthly compliance of TDS are necessary compliance, rest assured with a fee of Rs. 250 per employees.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
</div>
#Inderjeet just put
.box > .icon > .info {
height: 25em;
}
or some value that fit you and fix the inside p accordingly
Related
I'm trying to align 3 items in Flexbox.
To make things easier, here's the current layout
The goal here is to keep the numbers ( 1, 2, 3 etc.. ) on the left, strictly aligned, the texts strictly aligned too ( so that the up arrows are vertically aligned ), and the right icon should go wherever it must go as long as it's in the div.
Here's the code :
.div-container .form-div-container .small-text,
.div-container .form-div-container .longer-text,
.div-container .form-div-container .even-longer-text,
.div-container .form-div-container .longer-longer-longer-text,
.div-container .form-div-container .small-text-two {
display: flex;
justify-content: space-between;
}
The HTML :
<div class="div-container">
<div class="form-div-container">
<div class="small-text">
<p></p>
<div></div>
<img src="" alt="" srcset="">
</div>
<div class="longer-text">
<p></p>
<div></div>
<img src="" alt="" srcset="">
</div>
<div class="even-longer-text">
<p></p>
<div></div>
<img src="" alt="" srcset="">
</div>
<div class="longer-longer-longer-text">
<p></p>
<div></div>
<img src="" alt="" srcset="">
</div>
<div class="small-text-two">
<p></p>
<div></div>
<img src="" alt="" srcset="">
</div>
</div>
</div>
The thing is the icons are not all of the same width, so they push the middle item. How can I make things the way I want ? Thanks !
You could set the widths of the elements that contain the numbers and icons to a fixed percentage value like below:
.box__icon,
.box__number {
width: 15%;
text-align: center;
}
See a full demo below:
/*IGNORE STYLE RULES FROM HERE......*/
body {
margin: 0;
}
i {
font-style: normal;
}
.box {
color: white;
font-family: sans-serif;
font-size: 2rem;
font-weight: bold;
padding: 30px;
}
.box:nth-child(1) {
background: firebrick;
}
.box:nth-child(2) {
background: darkturquoise;
}
.box:nth-child(3) {
background: chocolate;
}
.box:nth-child(4) {
background: midnightblue;
}
.box__text::after {
content: "";
display: block;
width: 0;
height: 0;
border-style: solid;
border-width: 0 20px 20px 20px;
border-color: transparent transparent #ffffff transparent;
margin-top: 20px;
margin-left: auto;
margin-right: auto;
}
/*.... TO HERE*/
.box {
align-items: center;
display: flex;
justify-content: space-between;
}
.box__icon,
.box__number {
width: 15%; /*Change this to whatever value you want*/
text-align: center;
}
.box__text {
color: white;
font-family: sans-serif;
text-align: center;
}
<div class="container">
<div class="box">
<div class="box__number">1</div>
<p class="box__text">Small Text</p>
<i class="box__icon">Icon---</i>
</div>
<div class="box">
<div class="box__number">2</div>
<p class="box__text">Longer Text</p>
<i class="box__icon">Icon</i>
</div>
<div class="box">
<div class="box__number">3</div>
<p class="box__text">Even Longer Text</p>
<i class="box__icon">Icon--</i>
</div>
<div class="box">
<div class="box__number">4</div>
<p class="box__text">Longer Longer Longer Text</p>
<i class="box__icon">Icon---</i>
</div>
</div>
I would like the layout to look as so, but also be responsive (so that the heading + paragraph both stay positioned to the left of the icon).
CSS:
.feature {
position: relative;
border: 1px solid #000;
}
.circle {
height: 2.5rem;
width: 2.5rem;
background-color: #64beeb;
border-radius: 50%;
float: right;
}
.icon {
font-size: 1.75rem;
color: #fff;
}
HTML:
<div class="feature">
<div class="text text-right">
<p class="h2">Diversity of Content</p>
<p class="descrip">Dive deep and share themed content across various topics based on your audience</p>
</div>
<div class="circle text-center">
<i class="icon ion-android-bulb"></i>
</div>
</div>
CODEPEN DEMO
add this to .circle and remove float:right; Then it will be absolutely positioned from the parent relative container.
position: absolute;
top: 10px;
right: 10px;
.feature {
position: relative;
border: 1px solid #000;
}
.circle {
position: absolute;
top: 10px;
right: 10px;
height: 2.5rem;
width: 2.5rem;
background-color: #64beeb;
border-radius: 50%;
}
.icon {
font-size: 1.75rem;
color: #fff;
}
<div class="feature">
<div class="text text-right">
<p class="h2">Diversity of Content</p>
<p class="descrip">Dive deep and share themed content across various topics based on your audience</p>
</div>
<div class="circle text-center">
<i class="icon ion-android-bulb"></i>
</div>
</div>
And you could add padding-right: 50px; to .feature so the icon (blueih circle) will not be over text. See here https://jsfiddle.net/ymzofeph/
One option is to use flexbox. You can add display: flex to the container (.feature). Add flex: 1 to the text. To create some space around the icon you can use a margin value you find suitable.
.feature {
position: relative;
border: 1px solid #000;
/* for demo */
text-align: right;
display: flex;
}
.text {
flex: 1;
}
.circle {
height: 2.5rem;
width: 2.5rem;
background-color: #64beeb;
border-radius: 50%;
margin: 1rem;
}
.icon {
font-size: 1.75rem;
color: #fff;
}
<div class="feature">
<div class="text text-right">
<p class="h2">Diversity of Content</p>
<p class="descrip">Dive deep and share themed content across various topics based on your audience</p>
</div>
<div class="circle text-center">
<i class="icon ion-android-bulb"></i>
</div>
</div>
<div class="feature">
<div class="circle text-center">
<i class="icon ion-android-bulb"></i>
</div>
<div class="text text-right">
<p class="h2">Diversity of Content</p>
<p class="descrip">Dive deep and share themed content across various topics based on your audience</p>
</div>
</div>
<style>
.circle{
float:right;
width:40px;
height:40px;
margin:0 0 0 20px;
}
.text{
overflow:hidden;
}
</style>
Put the float:right div before the .text-right div. Then add padding-right:2.5rem; to the .text-right div.
Example
I'm new to CSS and HTML. My code is below. The footer hides a part from the last card. How do I fix this? I also want to know if this is the right way to implement this design or is there a better way?
my code:
http://plnkr.co/edit/iqoLHe46yxK335MsDknN?p=preview
<!DOCTYPE html>
<html>
<head>
<title>First</title>
<script src="jquery-3.1.1.min.js"></script>
<style>
#container{
width: 100%;
padding: 0 0 0 0%;
font-size: 0;
}
.container-header-menu{
position: fixed;
top: 0;
width: 100%;
height: 10%;
padding: 0 0 0 0%;
font-size: 0;
z-index: 10;
}
body {
margin:0px;
}
.header{
position: relative;
top: 0;
width: 100%;
background-color: #182538;
margin: 0px;
text-align: center;
display:inline-block;
font-size: 1rem;
}
.header-left-text{
display: inline-block;
color: #FFFFFF;
text-align: center;
vertical-align: middle;
line-height: normal;
float: left;
padding-left: 1cm;
font-family: sans-serif;
font-size: 80%;
}
.header-right-text{
display: inline-block;
color: #FFFFFF;
text-align: center;
vertical-align: middle;
line-height: normal;
float: right;
padding-right: 2cm;
font-family: sans-serif;
font-size: 80%;
}
.menu{
display:inline-block;
position:relative;
top: 0;
width: 100%;
background-color: #1F2D48;
margin: 0px;
text-align: center;
font-size: 1rem;
}
.menu-text{
display: inline-block;
color: #FFFFFF;
text-align: left;
vertical-align: middle;
line-height: normal;
float: right;
padding-right: 2cm;
font-family: sans-serif;
}
.menu-item{
width:13%;
float:left;
padding-right: 12px;
}
.card-list{
position: relative;
top: 100px;
width:13%;
height:83%;
float:left;
padding-right: 12px;
overflow-y: auto;
z-index: 5;
}
.card {
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
width: 100%;
margin: 5px;
background-color: #F2F2F2;
z-index: 5;
}
.card:hover {
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}
.card-header{
background-color: #F2F2F2;
}
.card-container {
background-color: #FFFFFF;
width: 100%;
position: relative;
margin: 0px;
text-align: center;
display:inline-block;
font-size: 1rem;
}
.card-container-header {
width: 100%;
position: relative;
margin: 0px;
text-align: center;
display:inline-block;
font-size: 1rem;
}
.footer{
position: fixed;
bottom: 0;
margin: 0px;
width: 100%;
height: 6%;
padding: 0 0 0 0%;
z-index: 100;
background-color: #1F2D48;
text-align: center;
}
.footer-left-text{
color: #FFFFFF;
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: normal;
float: left;
padding-left: 1cm;
font-family: sans-serif;
font-size: 80%;
}
.footer-right-button{
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: normal;
float: right;
font-family: sans-serif;
font-size: 100%;
background-color: #FFFFFF; /* Green */
border: none;
color: #1F2D48;
padding: 8px 32px;
border-radius: 8px;
margin: 4px;
border: 2px solid #1F2D48;
}
</style>
</head>
<body>
<div id="container">
<!-- header and menu bar container -->
<div class="container-header-menu">
<!-- header -->
<div class="header">
<p class="header-left-text"><strong>Lead Tracking:</strong> John Smith</p>
<p class="header-right-text">Monday, November 19, 2016</p>
</div>
<!-- menubar -->
<div class="menu">
<div class ="menu-item">
<p class="menu-text">Mapping</p>
</div>
<div class ="menu-item">
<p class="menu-text">Geology</p>
</div>
<div class ="menu-item">
<p class="menu-text">Engineering</p>
</div>
<div class ="menu-item">
<p class="menu-text">Negotiating</p>
</div>
<div class ="menu-item">
<p class="menu-text">Deal</p>
</div>
<div class ="menu-item">
<p class="menu-text">Rejected</p>
</div>
<div class ="menu-item">
<p class="menu-text">Pass</p>
</div>
</div>
</div>
<!-- card list for mapping-->
<div class="card-list">
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
</div>
<!-- card list for engineering-->
<div class="card-list">
<div class="card">
<div class="card-container-header">
<h1 style="color:orange; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
</div>
</div>
<div class="footer">
<p class="footer-left-text"><strong>Footer</strong></p>
<button type="button" class="footer-right-button" onclick="alert('Hello world!')">status</button>
<button type="button" class="footer-right-button" onclick="alert('Hello world!')">map</button>
<button type="button" class="footer-right-button" onclick="alert('Hello world!')">details</button>
</div>
</body>
</html>
Pastie Link
You can fix it by adding margin-bottom to class .card-list and it must be equals to the height of your footer.
so just add margin-bottom:6%;since 6% is the height of your footer.
You can add to your .card-list css;
margin-bottom:100px;
This provides a margin for the bottom of the area, so it doesn't overlap with any other elements.
Hope it helps!
Edit*
Chillers' answer is much better compared to mine, as it compensates for scaling between resolutions and devices.
I'm trying to create CSS styles that LOOK like a flip counter but don't actually function as one. I've got the general look and feel figured out, but I can't seem to get my box-shadow to overlap the display number.
This is what I have so far:
.numberwrapper {
width: 50px;
height: 90px;
background-color: black;
border-radius: 5px;
position: relative;
display: inline-block;
}
.shadow {
width: 100%;
height: 50%;
z-index: 100;
box-shadow: 0px 5px 4px -2px #888888;
}
.number {
font-family: 'Tahoma', sans-serif;
top: -90;
color: #ffffff;
font-size: 85px;
line-height: 0px;
text-align: center;
}
.bigcomma {
font-family: 'Tahoma', sans-serif;
font-size: 85px;
color: black;
}
<div class="numberwrapper">
<div class="shadow">
</div>
<div class="number">
1
</div>
</div>
<span class="bigcomma">,</span>
<div class="numberwrapper">
<div class="shadow">
</div>
<div class="number">
2
</div>
</div>
<div class="numberwrapper">
<div class="shadow">
</div>
<div class="number">
3
</div>
</div>
<div class="numberwrapper">
<div class="shadow">
</div>
<div class="number">
4
</div>
</div>
Like I said, my biggest issue is that I can't get my .shadow div to show up on top of the number.
Add "position: relative" to .shadow for the z-index to kick in:
.numberwrapper {
width: 50px;
height: 90px;
background-color: black;
border-radius: 5px;
position: relative;
display: inline-block;
}
.shadow {
width: 100%;
height: 50%;
z-index: 100;
box-shadow: 0px 5px 4px -2px #888888;
position: relative;
}
.number {
font-family: 'Tahoma', sans-serif;
top: -90;
color: #ffffff;
font-size: 85px;
line-height: 0px;
text-align: center;
}
.bigcomma {
font-family: 'Tahoma', sans-serif;
font-size: 85px;
color: black;
}
<div class="numberwrapper">
<div class="shadow">
</div>
<div class="number">
1
</div>
</div>
<span class="bigcomma">,</span>
<div class="numberwrapper">
<div class="shadow">
</div>
<div class="number">
2
</div>
</div>
<div class="numberwrapper">
<div class="shadow">
</div>
<div class="number">
3
</div>
</div>
<div class="numberwrapper">
<div class="shadow">
</div>
<div class="number">
4
</div>
</div>
I'm recreating a small widget from a psd and trying to put a thin border-right between the 3 container divs I'm using to separate the page into thirds. The divs have height, and I've tried adding in forced height to ensure that isn't the problem, but for some reason it just won't show up. The CSS has CSS Reset at the start, which you can grab from here.
Thanks for any help!
HTML
<div class="container">
<div class="img"><img src="1.png" alt=""></div>
<div class="txt">
<div><p class="title taa">10</p><p class="title2 tab">,000 hrs</p></div>
<div class="sub a"><p id="ac">Behavioural testing</p></div>
</div>
</div>
<div class="container">
<div class="img"><img src="2.png" alt=""></div>
<div class="txt">
<div><p class="title tba">8</p><p class="title2 tbb">years</p></div>
<div class="sub b"><p id="bc">Creafting successful user <br> experience since 2005</p></div>
</div>
</div>
<div class="container">
<div class="txt">
<div><p class="title tca">87</p><p class="title2 tcb">years</p></div>
<div class="sub c"><p id="cc">Collective experience</p></div>
</div>
<div class="img"><img src="3.png" alt=""></div>
</div>
CSS
.container {
display: inline-block;
width: 600px;
height: 300px;
border-right: 10px red;
}
.img {
display: inline-block;
}
.txt {
display: inline-block;
}
.title {
font-family: Helvetica;
font-weight: bold;
font-size: 91px;
display: inline-block;
}
.title2 {
font-family: Helvetica;
font-weight: bold;
font-size: 57px;
display: inline-block;
}
.sub {
font-family: Helvetica;
font-size: 22px;
}
.a {
position: relative;
left: 8px;
}
Change it to border-right: 10px solid red;
Border requires size and type of border; color is optional.