I have a task that supports older browsers such as IE9, so I cannot use flexbox or CSS Grid.
I'm struggling with making the .second and .third have equal height as the .first div.
Here is my attempt.
https://codepen.io/abccba_123/pen/QWKMwpK
img {
width: 100%;
height: auto;
}
.first img {
background-color: gold;
}
.second img {
background-color: cyan;
}
.third img {
background-color: grey;
}
.container {
width: 1000px;
margin: 0 auto;
}
.container article {
position: relative;
}
.wrap {
position: absolute;
bottom: 0;
}
.first {
float: left;
width: 50%;
}
.second {
float: left;
width: 30%;
}
.third {
float: left;
width: 30%;
}
<div class="container">
<article class="first">
<img width="1920" height="1080">
<div class="wrap">
<h3>Lorem ipsum dolor sit amet.<h3>
</div>
</article>
<article class="second">
<img width="1920" height="1080">
<div class="wrap">
<h3>Lorem ipsum dolor sit amet.<h3>
</div>
</article>
<article class="third">
<img width="1920" height="1080">
<div class="wrap">
<h3>Lorem ipsum dolor sit amet.<h3>
</div>
</article>
</div>
What I want.
Thank you!!
You may also use a display:table reset ;) Understood by every browsers and IE8+
(.wrap div removed , but you can use it)
img {
width: 100%;
height: auto;
}
.first {
background-color: gold;
}
.second {
background-color: cyan;
margin-bottom: 5px;
}
.third {
background-color: grey;
}
.container {
width: 100%;/* for demo */
/* width:1000px; */
margin: 0 auto;
display: table;
/* IE8 + */
table-layout: fixed;
/* IE8 + */
border-spacing: 5px;
border: solid;
}
.container article {
border: solid;
margin: -left:5px;
}
h3 {
padding: 1em;
}
.img {
vertical-align: top;
}
.first {
display: table-cell;
/* IE8 + */
width: 50%;
vertical-align: top;
}
<div class="container">
<article class="first">
<img src="https://picsum.photos/id/118/536/354.jpg" width="1920" height="1080">
<h3>Lorem ipsum dolor sit amet. </h3>
</article>
<article class="second">
<img src="https://picsum.photos/id/1015/536/354.jpg" width="1920" height="1080">
<h3>Lorem ipsum dolor sit amet. </h3>
</article>
<article class="third">
<img src="https://picsum.photos/id/1016/536/354.jpg" width="1920" height="1080">
<h3>Lorem ipsum dolor sit amet. </h3>
</article>
</div>
A simple table layout:
img {
display:block;
}
.first img {
background-color: gold;
}
.second img {
background-color: cyan;
}
.third img {
background-color: grey;
}
.container {
margin: 0 auto;
}
.container td {
position: relative;
}
.container td h3 {
position:absolute;
bottom:0;
left:0;
right:0;
}
<table class="container">
<tr>
<td class="first" rowspan="2">
<img width="300" height="400">
<h3>Lorem ipsum dolor sit amet.</h3>
</td>
<td class="second">
<img width="300" height="200">
<h3>Lorem ipsum dolor sit amet.</h3>
</td>
</tr>
<tr>
<td class="third">
<img width="300" height="200">
<h3>Lorem ipsum dolor sit amet.</h3>
</td>
</tr>
</table>
.cont {
width: 1000px;
margin: 0 auto;
}
img {
width: 100%;
height: 100%;
}
article {
position: relative;
}
.first {
float: left;
width: 500px;
height: 300px;
background-color: gold;
}
.second, .third {
float: left;
width: 500px;
height: 150px;
overflow: hidden;
}
.second {
background-color: lime;
}
.third {
background-color: cyan;
}
.info {
color: white;
padding: 10px 10px 0 10px;
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
<div class="cont">
<article class="first">
<img src="https://picsum.photos/1920/1080" width="1920" height="1080">
<div class="info">
<h3>Lorem ipsum dolor sit amet.</h3>
</div>
</article>
<article class="second">
<img src="https://picsum.photos/1920/1080" width="1920" height="1080">
<div class="info">
<h3>Lorem ipsum dolor sit amet.</h3>
</div>
</article>
<article class="third">
<img src="https://picsum.photos/1920/1080" width="1920" height="1080">
<div class="info">
<h3>Lorem ipsum dolor sit amet.</h3>
</div>
</article>
</div>
I've partially solved my own problem.
Related
Trying to get my divs responsive. Can't seem to make this work. The image resizes fine but the text divs do not. They just hide as the page resizes. I probably have not done this right to begin with. Please take a look at it and let me know what I need to change.
Any help you can provide is appreciated.
.responsive .containerCollab {
max-width: 1110px;
}
.containerCollab {
display: grid;
width: 90%;
height: 100%;
max-width: 1110px;
min-width: 500px;
margin: auto;
grid-template-areas: "a-XQDl2-0 NameTitle"
"a-w0pwv-0 HR1"
"left right"
"a-79302-0 HR2";
grid-template-columns: 01fr 4fr;
grid-template-rows: 70px 30px 160px 30px;
}
.containerCollab>div {
border: px dashed #888;
float: left;
}
.a-XQDl2-0 {
grid-area: a-XQDl2-0;
}
.NameTitle {
grid-area: NameTitle;
position: relative;
top: 30px;
left: 75px;
}
.NameTitleText {
font: 28px pt sans, sans-serif;
}
.HR1 {
grid-area: HR1;
position: relative;
top: 30px;
}
.HR1line hr {
max-width: 700px;
width: 700px;
border-color: #3579b5;
}
.HR2 {
grid-area: HR1;
position: relative;
bottom: 20px;
}
.HR2line hr {
max-width: 818px;
width: 818px;
border-color: #3579b5;
}
.left {
grid-area: left;
}
.leftimg {
margin: auto;
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
}
.leftimg img {
width: 250px;
position: relative;
}
.right {
grid-area: right;
margin: auto;
}
.righttext p {
max-width: 78%;
text-align: left;
margin: auto;
position: relative;
float: right;
margin-right: 10%;
width: 100%;
}
.HR2 {
grid-area: HR2;
}
<!DOCTYPE html>
<html>
<head>
<title>HTML, CSS and JavaScript demo</title>
</head>
<body>
<!-- Start your code here -->
<div id="wrap_all">
<div class="containerCollab">
<div class="NameTitle">
<div class="NameTitleText">
<p>Collaborations</p>
</div>
</div>
<div class="HR1">
<div class="HR1line">
<hr />
</div>
</div>
<div class="left">
<div class="leftimg">
<img src="https://www.w3schools.com/html/img_girl.jpg" />
</div>
</div>
<div class="right">
<div class="righttext">
<p>lorem ipsum lorem ipsum lorem ipsumlorem ipsumlorem ipsumlorem ipsumlorem ipsumlorem ipsumlorem ipsumlorem ipsum .<br />
<br />
lorem ipsum lorem ipsumlorem ipsumlorem ipsum lorem ipsumlorem ipsumlorem ipsumlorem ipsumlorem ipsumlorem ipsumlorem ipsum.</p>
</div>
</div>
<div class="HR2">
<div class="HR1line">
<hr />
</div>
</div>
</div>
</div>
<!-- End your code here -->
</body>
</html>
If you are looking for responsive webpages, elements on webpages, you might want to look into Bootstrap
If you follow the way they set it up on the page, you will see that it improves.
Also, as some others have mentioned, you do not want fixed px set if you want responsiveness. You rather want vw/vh, percentages.
w3schools has also some easy start demo's on responsiveness. You might want to check it out.
I'm running into an issue with flex-wrap. Where I need flex-wrap: wrap to take care that images wrap and don't run out of the container. I don't need wrap for a link. See my issue below, also my code is included in the post.
JSFiddle
HTML
<div class="box">
<div class="image">
<img src="https://dummyimage.com/80x80/000/fff">
<img src="https://dummyimage.com/80x80/000/fff">
<img src="https://dummyimage.com/80x80/000/fff">
<img src="https://dummyimage.com/80x80/000/fff">
</div>
<div class="tools">
View details
</div>
</div>
<div class="box">
<div class="image">
<img src="https://dummyimage.com/80x80/000/fff">
Lorem ipsum dolor sit amet, consectetur adipisicing dolor sit amet, consectetur.
</div>
<div class="tools">
View details
</div>
</div>
SCSS
.box {
border: 1px solid gray;
width: 100%;
display: flex;
margin-bottom: 15px;
&:after {
content: "";
display: table;
clear: both;
}
.image {
float: left;
width: 60%;
border-right: 1px solid gray;
display: flex;
align-items: center;
flex-wrap: wrap;
padding: 5px;
a {
text-decoration: none;
&:not(:last-of-type) {
margin-right: 5px;
}
}
}
.tools {
float: left;
width: 40%;
padding: 5px;
}
}
You can achieve this by adding
.box .image a:last-of-type {
flex: 1 1 0;
}
.box {
border: 1px solid gray;
width: 100%;
display: flex;
margin-bottom: 15px;
}
.box:after {
content: "";
display: table;
clear: both;
}
.box .image {
float: left;
width: 60%;
border-right: 1px solid gray;
display: flex;
align-items: center;
flex-wrap: wrap;
padding: 5px;
}
.box .image a {
text-decoration: none;
}
.box .image a:last-of-type {
flex: 1 1 0;
}
.box .image a:not(:last-of-type) {
margin-right: 5px;
}
.box .tools {
float: left;
width: 40%;
padding: 5px;
}
<div class="box">
<div class="image">
<img src="https://dummyimage.com/80x80/000/fff">
<img src="https://dummyimage.com/80x80/000/fff">
<img src="https://dummyimage.com/80x80/000/fff">
<img src="https://dummyimage.com/80x80/000/fff">
</div>
<div class="tools">
View details
</div>
</div>
<div class="box">
<div class="image">
<img src="https://dummyimage.com/80x80/000/fff">
Lorem ipsum dolor sit amet, consectetur adipisicing dolor sit amet, consectetur.
</div>
<div class="tools">
View details
</div>
</div>
Min Width & Overflow Hidden
If you use min-width of 80px which is your image box size and add overflow:hidden, everything fits in fine and there's nothing falling out.
To make the demo better, I made the other columns a min-width of 80px and total min-width 160px (2x80px) and gave all containers overflow:hidden.
The Working Demo
See it working here
The Code
SCSS
.box {
border: 1px solid gray;
width: 100%;
display: flex;
margin-bottom: 15px;
min-width:160px;
overflow:hidden;
&:after {
content: "";
display: table;
clear: both;
}
.image {
float: left;
width: 60%;
min-width:80px;
overflow:hidden;
border-right: 1px solid gray;
display: flex;
align-items: center;
flex-wrap: wrap;
padding: 5px;
a {
text-decoration: none;
&:not(:last-of-type) {
margin-right: 5px;
}
}
}
.tools {
float: left;
width: 40%;
padding: 5px;
overflow:hidden;
flex-wrap: wrap;
min-width:80px;
}
}
HTML
<div class="box">
<div class="image">
<img src="https://dummyimage.com/80x80/000/fff">
<img src="https://dummyimage.com/80x80/000/fff">
<img src="https://dummyimage.com/80x80/000/fff">
<img src="https://dummyimage.com/80x80/000/fff">
</div>
<div class="tools">
View details
</div>
</div>
<div class="box">
<div class="image">
<img src="https://dummyimage.com/80x80/000/fff">
Lorem ipsum dolor sit amet, consectetur adipisicing dolor sit amet, consectetur.
</div>
<div class="tools">
View details
</div>
</div>
You can add an extra container around the single box and the text. Define it as a flexbox and it will scale according to your desires.
* {
box-sizing: border-box;
}
.box {
border: 1px solid gray;
width: 100%;
display: flex;
margin-bottom: 15px;
}
.box:after {
content: "";
display: table;
clear: both;
}
.image {
width: 60%;
border-right: 1px solid gray;
display: flex;
align-items: center;
flex-wrap: wrap;
padding: 5px;
}
.image a {
text-decoration: none;
}
.image a:not(:last-of-type) {
margin-right: 5px;
}
.tools {
width: 40%;
padding: 5px;
}
<div class="box">
<div class="image">
<img src="https://dummyimage.com/80x80/000/fff">
<img src="https://dummyimage.com/80x80/000/fff">
<img src="https://dummyimage.com/80x80/000/fff">
<img src="https://dummyimage.com/80x80/000/fff">
</div>
<div class="tools">
View details
</div>
</div>
<div class="box">
<div class="image">
<div style="display:flex; align-items: center;">
<img src="https://dummyimage.com/80x80/000/fff">
Lorem ipsum dolor sit amet, consectetur adipisicing dolor sit amet, consectetur.
</div>
</div>
<div class="tools">
View details
</div>
</div>
Please check my fiddle where I added my solution https://jsfiddle.net/Lazzaro/vkrh48tn/
I added new class
.image2 {
width: 60%;
border-right: 1px solid gray;
display: flex;
align-items: center;
flex-wrap: nowrap;
padding: 5px;
a {
text-decoration: none;
&:not(:last-of-type) {
margin-right: 5px;
}
}
}
and it works
I am having some issues to add a background color in the 3 sections created in html. Could you please have a look and let me know what I am doing wrong with the coding? I can only see the background color when I write in html style="background-color:whatever color". Looks like the CSS is not applying the changes I am trying over and over.
* {
margin: 0px;
padding: 0px;
}
.container {
margin: auto;
width: 80%;
overflow: hidden;
}
header {
border-bottom: 1px solid green;
background-color: #e7e7e7;
}
#logo {
float: left;
margin-top: 20px;
}
nav {
float: right;
margin-top: 20px;
}
nav li {
float: left;
display: inline;
list-decoration: none;
padding: 20px 20px 20px 20px;
}
nav li a {
color: #333333;
text-decoration: none;
font-weight: bold;
font-size: 18px;
}
--------- #firstpart {
margin-top: 40px;
height: 300px;
background-color: fuchsia;
}
.cajaslider {
margin-top: 20px;
margin-bottom: 20px;
float: left;
border: 1px solid navy;
height: 400px;
width: 55%;
}
#twitter {
padding-top: 5px;
margin-left: 40px;
float: right;
height: 300px;
width: 38%;
}
#columns {
width: 65%;
}
#secondpart {
padding-top: 20px;
height: 425px;
background-color: #e44d26;
}
#secondpart h3 {
font-size: 20px;
text-align: left;
}
.text {
float: left;
width: 30%;
padding-right: 25px;
text-align: justify;
}
.text a {
text-decoration: none;
color: white;
}
.text1 {
float: left;
width: 30%;
padding-right: 10px;
border-right: 1px solid maroon;
text-decoration: none;
}
.text1 a {
text-decoration: none;
color: white;
}
.text1 p {
text-align: left;
color: white;
}
.text p {
text-align: left;
color: white;
}
.button1 {
padding: 5px;
margin-top: 5px;
border-bottom-color: maroon;
}
#formright {
float: right;
width: 32%;
height: 350px;
padding: 15px 10px 15px 10px;
background-color: #666666;
color: white;
margin-right: -45px;
border-radius: 5%;
border-right: 5%;
}
#entries {
margin-left: 15px;
margin-top: -25px;
}
#entries input[type=name] {
padding: 4px;
height: 25px;
width: 250px;
}
#hr1 {
margin-top: -40px;
}
------- footer {
margin-top: 20px;
}
#socialmedia {
margin-left: 250px;
margin-top: 30px;
}
#socialmedia li {
float: left;
list-style: none;
display: inline;
width: 20%;
padding: 20px 5px 20px 5px;
}
<!------------------------About page--------------------->#aboutsect {
height: 300px;
background-color: yellow;
}
.caja {
margin-top: 20px;
height: 550px;
border-bottom: 1px solid green;
}
#mainimg {
float: left;
width: 35%;
background-color: white;
}
#content {
float: right;
width: 45%;
background-color: white;
}
-------- section h2 {
margin-top: 20px;
margin-bottom: 20px;
}
section .button1 {
margin-top: 20px;
}
.caja2 {
margin-top: 20px;
padding-left: 150px;
margin-bottom: 20px;
}
.person {
float: left;
margin-left: 30px;
width: 30%;
margin-bottom: 40px;
}
section img {
border-radius: 50%;
height: 100px;
width: 100px;
}
section h3 {
font-size: 15px;
margin-left: 10px;
margin-top: 20px;
}
section p.centrado {
font-size: 15px;
margin-left: 5px;
margin-top: 20px;
}
section p {
font-size: 15px;
margin-left: -40px;
margin-top: 20px;
}
------- #clients {
height: 200px;
background-color: yellow;
}
#clients h3 {
margin-top: 60px;
}
#cajaotra {
margin-top: 20px;
height: 200px;
border-bottom: 1px solid green;
margin-left: 150px;
}
.client1 {
margin-top: 30px;
padding: 10px;
margin-right: 70px;
}
------ <!------------------------Service page---------------------!>#services {
height: 300px;
}
#cajafoto {
height: 300px;
border-bottom: 1px solid blue;
}
.equip {
height: 200px;
width: 80%;
margin-left: 100px;
margin-top: 20px;
}
----------------- #fraccion {
height: 400px;
}
#cajaourservices {
margin-top: 50px;
height: 200px;
}
#ourservices {
float: left;
width: 60%;
}
#wantmore {
float: right;
width: 30%;
}
----------------- #serviceimages {
height: 400px;
}
#cajaimagenes {
height: 300px;
margin-top: 30px;
}
.train {
width: 25%;
margin-left: 20px;
padding: 30px;
float: left;
}
<body>
<header>
<div class="container">
<div id="logo">
<a href="http://www.elpais.com">
<img src="bottle2.jpg" title="bottle" height="50" width="50"></a>
<p>Drink Me</p>
</div>
<nav>
<ul>
<li>Home</li>
<li>About Us</li>
<li>Our Wines </li>
<li>Contact</li>
</ul>
</nav>
</div>
</header>
<section id="aboutsect">
<div class="container">
<div class="caja">
<div id="mainimg">
<img src="circle.jpg" alt="the team">
</div>
<aside id="content">
<h2>Title</h2>
<p>Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem
Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum </p>
<button class="button1" type="submit">Read More</button>
</aside>
</div>
</div>
</section>
<section id="meet">
<div class="container">
<h3>MEET THE TEAM</h3>
<hr>
<div class="caja">
<div class="caja2">
<div class="person">
<img src="rostro.jpg">
<h3>James Keating</h3>
<p class="centrado">Profile Description</p>
<p>Lorem Ipsum Lorem Ipsum Lorem Ipsum</p>
</div>
<div class="person">
<img src="rostro.jpg">
<h3>James Keating</h3>
<p class="centrado">Profile Description</p>
<p>Lorem Ipsum Lorem Ipsum Lorem Ipsum</p>
</div>
<div class="person">
<img src="rostro.jpg">
<h3>James Keating</h3>
<p class="centrado">Profile Description</p>
<p>Lorem Ipsum Lorem Ipsum Lorem Ipsum</p>
</div>
</div>
<br>
<br>
<div class="caja2">
<div class="person">
<img src="rostro.jpg">
<h3>James Keating</h3>
<p class="centrado">Profile Description</p>
<p>Lorem Ipsum Lorem Ipsum Lorem Ipsum</p>
</div>
<div class="person">
<img src="rostro.jpg">
<h3>James Keating</h3>
<p class="centrado">Profile Description</p>
<p>Lorem Ipsum Lorem Ipsum Lorem Ipsum</p>
</div>
<div class="person">
<img src="rostro.jpg">
<h3>James Keating</h3>
<p class="centrado">Profile Description</p>
<p>Lorem Ipsum Lorem Ipsum Lorem Ipsum</p>
</div>
</div>
</div>
</div>
</section>
<section id="clients">
<div class="container">
<h3>OUR CLIENTS</h3>
<div id="cajaotra">
<img class="client1" src="client1.jpg">
<img class="client1" src="client1.jpg">
<img class="client1" src="client1.jpg">
<img class="client1" src="client1.jpg">
<img class="client1" src="client1.jpg">
</div>
</div>
</section>
<footer>
<div class="container">
<ul id="socialmedia">
<li>Facebook<img src="facebook.png" height="24" width="24"></li>
<li><img src="facebook.png" height="24" width="24">Twitter</li>
<li><img src="facebook.png" height="24" width="24">LinkedIn</li>
</ul>
</div>
</footer>
</body>
Remove all ---- lines and <!-- xxx --> lines from your CSS, as these are not valid CSS and may prevent your CSS from being properly applied. CSS comments usually use the C syntax (/* comment */).
I am getting scroll issue in chat website. Where bottom scrollbar is not visible and scroll is not working in live chat.
#charset "utf-8";
/* CSS Document */
html,
body {
font-family: Arial, Gotham, "Helvetica Neue", Helvetica, sans-serif;
line-height: 20px;
margin: 0;
padding: 0;
overflow: hidden;
box-sizing: border-box;
height: 100%;
}
.inner {
max-width: 100%;
padding: 0 20px;
}
.col-1,
.col-10,
.col-11,
.col-12,
.col-2,
.col-3,
.col-4,
.col-5,
.col-6,
.col-7,
.col-8,
.col-9 {
display: block;
position: relative;
float: left;
width: 100%
}
.text-left {
text-align: left;
}
.text-center {
text-align: center;
}
.text-right {
text-align: right;
}
header {
position: fixed;
z-index: 9999;
top: 0;
left: 0;
width: 100%;
background: #333;
min-height: 60px;
}
header:after {
clear: both;
content: '';
display: table;
}
header nav {
position: relative;
padding: 20px;
}
.credit {
position: absolute;
top: 0;
right: 40px;
color: #fff;
text-align: right;
text-transform: capitalize;
font-weight: 700;
}
.credit i {
position: absolute;
top: 26px;
padding-left: 20px;
}
.credit p {
margin: 10px 0 0 0;
padding: 0;
}
.trigger {
display: inline-block;
cursor: pointer;
}
.bar1,
.bar2,
.bar3 {
width: 28px;
height: 3px;
background-color: #fff;
margin: 6px 0;
transition: 0.4s;
}
/* Rotate first bar */
.change .bar1 {
-webkit-transform: rotate(-45deg) translate(-4px, 6px);
transform: rotate(-45deg) translate(-9px, 6px);
}
/* Fade out the second bar */
.change .bar2 {
opacity: 0;
}
/* Rotate last bar */
.change .bar3 {
-webkit-transform: rotate(45deg) translate(-8px, -8px);
transform: rotate(45deg) translate(-8px, -8px);
}
.col-3:after {
content: '';
clear: both;
display: block;
}
.logo a {
position: absolute;
top: 26px;
left: 80px;
font-size: 28px;
display: block;
text-decoration: none;
color: #fff;
text-transform: uppercase;
}
.bets,
.video,
.chat {
position: relative;
overflow-y: scroll;
height: 100%;
z-index: 1;
background: #191919;
}
.PB15 {
padding: 15px 15px 15px 30px;
}
.section {
position: relative;
height: 100%;
width: 100%;
padding-top: 78px;
}
.PB80 {
padding-bottom: 78px;
}
.bets-title {
background: #282828;
padding: 15px 15px 15px 45px;
color: #fff;
line-height: 15px;
}
.bets-title span {
padding-left: 15px;
font-weight: 600;
}
.video {
background: #222222;
}
.video .video-content {
padding: 20px 10px 30px 60px;
}
.wrapper {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
overflow: scroll;
}
.video-title {
list-style: none;
color: #fff;
margin: 0;
padding: 0;
}
.video-title li {
display: inline-block;
}
.video-title li:first-child {
font-size: 20px;
font-weight: 700;
}
.video-title li:last-child {
color: rgba(159, 159, 159, 1.00);
position: absolute;
right: 0;
margin-right: 20px;
}
.list {
list-style: none;
margin: 0;
padding: 10px 0 0 0;
}
.video h3 {
color: #fff;
}
.list li {
display: inline-block;
color: #fff;
}
.list span {
padding: 0 20px 0 10px;
color: rgba(159, 159, 159, 1.00);
}
.max-100 {
display: block;
max-width: 100%;
}
.chat .bets-title {
margin-bottom: 10px;
}
.container {
padding: 20px 0 0 20px;
}
.users {
position: relative;
margin-bottom: 15px;
display: flex;
}
.users img {
width: 30px;
height: 30px;
max-width: 100%;
}
.username {
color: #a7a7a7;
font-weight: 600;
}
.users .user-msg {
color: #fff;
padding: 0 20px;
}
.users span:last-child {
padding-left: 10px;
}
.col-1 {
width: 8.33333333333%
}
.col-2 {
width: 16.6666666667%
}
.col-3 {
width: 25%
}
.col-4 {
width: 33.3333333333%
}
.col-5 {
width: 41.6666666667%
}
.col-6 {
width: 50%
}
.col-7 {
width: 58.3333333333%
}
.col-8 {
width: 66.6666666667%
}
.col-9 {
width: 75%
}
.col-10 {
width: 83.3333333333%
}
.col-11 {
width: 91.6666666667%
}
.col-12 {
width: 100%
}
#media (min-width: 768px) {
.col-3 {
width: 100%;
}
.col-6 {
width: 100%;
}
}
#media (min-width: 1200px) {
.col-1 {
width: 8.33333333333%
}
.col-2 {
width: 16.6666666667%
}
.col-3 {
width: 25%
}
.col-4 {
width: 33.3333333333%
}
.col-5 {
width: 41.6666666667%
}
.col-6 {
width: 50%
}
.col-7 {
width: 58.3333333333%
}
.col-8 {
width: 66.6666666667%
}
.col-9 {
width: 75%
}
.col-10 {
width: 83.3333333333%
}
.col-11 {
width: 91.6666666667%
}
.col-12 {
width: 100%
}
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Live Chat</title>
</head>
<body>
<header>
<div class="inner">
<nav>
<div class="trigger" onclick="myFunction(this)">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
</div>
<div class="logo">Chat
</div>
<div class="credit">
<p>Credtis available</p>
<p>23,000</p>
<i class="fa fa-user-circle"></i>
</div>
</nav>
</div>
</header>
<div class="section">
<div class="col-3">
<div class="bets-title">
<i class="fa fa-angle-right"></i> <span>Live Bets</span>
</div>
<div class="bets">
</div>
<div class="PB80"></div>
</div>
<div class="col-6 video">
<div class="video-contents">
<video width="100%" height="100%" controls>
<source src="demo.mp4" type="video/mp4"></source>
Your browser does not support the video tag.
</video>
<div class="video-content">
<ul class="video-title">
<li>The Mighty Scrpio VS Legacy Prime Mantis</li>
<li>1,548 watching now</li>
</ul>
<ul class="list">
<li><i class="fa fa-thumbs-o-up"></i><span>2.8k</span>
</li>
<li><i class="fa fa-thumbs-o-down"><span>112</span></i>
</li>
<li><i class="fa fa-reply"></i>
</li>
</ul>
<h3>Current Best Total: 13,000 credits</h3>
</div>
</div>
<div class="video-contents">
<video width="100%" height="100%" controls>
<source src="demo.mp4" type="video/mp4"></source>
Your browser does not support the video tag.
</video>
<div class="video-content">
<ul class="video-title">
<li>The Mighty Scrpio VS Legacy Prime Mantis</li>
<li>1,548 watching now</li>
</ul>
<ul class="list">
<li><i class="fa fa-thumbs-o-up"></i><span>2.8k</span>
</li>
<li><i class="fa fa-thumbs-o-down"><span>112</span></i>
</li>
<li><i class="fa fa-reply"></i>
</li>
</ul>
<h3>Current Best Total: 13,000 credits</h3>
</div>
</div>
<div class="video-contents">
<video width="100%" height="100%" controls>
<source src="demo.mp4" type="video/mp4"></source>
Your browser does not support the video tag.
</video>
<div class="video-content">
<ul class="video-title">
<li>The Mighty Scrpio VS Legacy Prime Mantis</li>
<li>1,548 watching now</li>
</ul>
<ul class="list">
<li><i class="fa fa-thumbs-o-up"></i><span>2.8k</span>
</li>
<li><i class="fa fa-thumbs-o-down"><span>112</span></i>
</li>
<li><i class="fa fa-reply"></i>
</li>
</ul>
<h3>Current Best Total: 13,000 credits</h3>
</div>
</div>
<div class="PB80"></div>
</div>
<div class="col-3">
<div class="bets-title">
<i class="fa fa-angle-right"></i> <span>Live Chat</span>
</div>
<div class="chat PB15">
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet Rupareliya</span><span>Lorem ipsum dolor sit amet, consectetur.</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet Raina</span><span>Lorem ipsum dolor sit amet, consectetur.</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet</span><span>Lorem ipsum</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet Rupareliya</span><span>Lorem ipsum dolor sit amet, consectetur adipisicing.</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet Raina</span><span>Lorem ipsum dolor sit amet, consectetur.</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet Rupareliya</span><span>Lorem ipsum dolor sit amet, consectetur.</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet Raina</span><span>Lorem ipsum dolor sit amet, consectetur.</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet</span><span>Lorem ipsum</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet Rupareliya</span><span>Lorem ipsum dolor sit amet, consectetur adipisicing.</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet Raina</span><span>Lorem ipsum dolor sit amet, consectetur.</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet Rupareliya</span><span>Lorem ipsum dolor sit amet, consectetur.</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet Raina</span><span>Lorem ipsum dolor sit amet, consectetur.</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet</span><span>Lorem ipsum</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet Rupareliya</span><span>Lorem ipsum dolor sit amet, consectetur adipisicing.</span>
</div>
</div>
<div class="users">
<div class="user-msg">
<span class="username">Abhijeet Raina</span><span>Lorem ipsum dolor sit amet, consectetur.</span>
</div>
</div>
<div class="PB80"></div>
</div>
</div>
</div>
</body>
</html>
Your chat class is assigned to wrong block. You have col-6 video block. Under that you have block with class col-3 to wrap your chat html. Just give him your special class chat and everything should work
How to align image and content inside div under div. tried with float left but not working
Js fiddle link for quick overview
here is the CSS:
.container {
clear: both;
padding: 0px;
margin: 0px;
overflow:hidden;
}
.profile1 {
background-color: #CCF;
}
.profile2 {
background-color: #CFC;
}
.profile3 {
background-color: #FCC;
}
#media only screen and (min-width: 480px) {
.span_1_of_3 {
width: 32.2%;
}
.col {
display: block;
float: left;
margin: 1% 0 1% 1.6%;
}
.col:first-child {
margin-left: 0;
}
}
HTML:
<div class="container" style="border:2px solid black;">
<div class="col span_1_of_3 profile1"><img src="http://placehold.it/100x100"/>Lorem ipsum dolor sit amet</div>
<div class="col span_1_of_3 profile2"><img src="http://placehold.it/100x100"/>Lorem ipsum dolor sit amet</div>
<div class="col span_1_of_3 profile3"><img src="http://placehold.it/100x100"/>Lorem ipsum dolor sit amet</div>
</div>
Floating image to the left seems to be working just fine: http://jsfiddle.net/rTZJ9/.
.col > img {
float: left;
}
DRD's aswer is good and You may also use align="left" inside img tag.
<img src="http://placehold.it/100x100" align="left"/>
#Sharanpreet The align attribute of is not supported in HTML5. Use CSS instead.