I'm having an issue related to using divs with the display set to table-cell. The purpose of using table-cell was so that the height of these two divs would match up. However, each of these divs also have another div set inside it to create the yellow dotted outline you see in the picture:
When one of the table cells grow, the yellow outline of the other doesn't grow to match its adjacent one. Hoping someone can help me with a fix, any help appreciated. Here is my code below:
.generalinfocontainer {
width: 50%;
height: auto;
background-image: url("https://imgur.com/qbIkHqm.png");
display: table-cell;
border-radius: 25px;
text-shadow: 1px 1px #000000;
}
.statscontainer {
width: 30%;
height: auto;
background-image: url("https://imgur.com/qbIkHqm.png");
display: table-cell;
border-radius: 25px;
text-shadow: 1px 1px #000000;
}
.t {
display: table;
width: 100%;
border-spacing: 20px;
}
.generalinfowrapper {
border-width: 2px;
border-color: yellow;
border-style: dashed;
margin: 3px;
border-radius: 25px;
height: 100%;
padding: 8px;
}
.statswrapper {
border-width: 2px;
border-color: yellow;
border-style: dashed;
margin: 3px;
border-radius: 25px;
height: 100%;
padding: 8px;
}
.statbar {
border-radius: 15px;
background-image: url("https://imgur.com/gdh95cn.png");
padding: 1px;
width: 100%;
height: auto;
border-style: solid;
border-color: black;
border-width: 1px;
}
.fillbar {
border-radius: 15px;
background-color: #a3c1ad;
height: 100%;
padding-left: 4px;
border-color: black;
border-width: 1px;
border-style: solid;
margin: 0px;
}
.boxtitle {
text-align: center;
}
<div class="t">
<div class="generalinfocontainer">
<div class="generalinfowrapper">
[b][size=24][color=yellow]KOMON HYUUGA[/color][/size][/b]
</div>
</div>
<div class="statscontainer">
<div class="statswrapper">
<div class="boxtitle">
[b][size=24][color=yellow]STATISTICS[/color][/size][/b]
</div>
[b]VIGOR[/b]<br />
<div class="statbar">
<div class="fillbar" style="width:80%;"> 80/100</div>
</div>
[b]CHAKRA[/b]<br />
<div class="statbar">
<div class="fillbar" style="width:80%;"> 80/100</div>
</div>
[b]SPEED[/b]<br />
<div class="statbar">
<div class="fillbar" style="width:80%;"> 80/100</div>
</div>
[b]STRENGTH[/b]<br />
<div class="statbar">
<div class="fillbar" style="width:80%;"> 80/100</div>
</div>
</div>
</div>
The purpose of using table-cell was so that the height of these two divs would match up.
Well, what you are trying to achieve can be done with less code using Flexbox, or CSS Grid. Take a look:
.t {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 20px;
}
.generalinfocontainer,
.statscontainer {
background-image: url("https://imgur.com/qbIkHqm.png");
border-radius: 25px;
text-shadow: 1px 1px #000000;
border-width: 2px;
border-color: yellow;
border-style: dashed;
padding: 8px;
}
.statbar {
border-radius: 15px;
background-image: url("https://imgur.com/gdh95cn.png");
padding: 1px;
border: 1px solid solid black;
}
.fillbar {
border-radius: 15px;
background-color: #a3c1ad;
padding-left: 4px;
border: 1px solid black;
}
.boxtitle {
text-align: center;
}
<div class="t">
<div class="generalinfocontainer">
<div class="generalinfowrapper">
[b][size=24][color=yellow]KOMON HYUUGA[/color][/size][/b]
</div>
</div>
<div class="statscontainer">
<div class="statswrapper">
<div class="boxtitle">
[b][size=24][color=yellow]STATISTICS[/color][/size][/b]
</div>
[b]VIGOR[/b]<br />
<div class="statbar">
<div class="fillbar" style="width:80%;"> 80/100</div>
</div>
[b]CHAKRA[/b]<br />
<div class="statbar">
<div class="fillbar" style="width:80%;"> 80/100</div>
</div>
[b]SPEED[/b]<br />
<div class="statbar">
<div class="fillbar" style="width:80%;"> 80/100</div>
</div>
[b]STRENGTH[/b]<br />
<div class="statbar">
<div class="fillbar" style="width:80%;"> 80/100</div>
</div>
</div>
</div>
</div>
Related
I am trying to create a Product catalog. I have planned to create multiple rows whereas in each row there would be 2 products each.
Thus in each row the 1st product belongs to product-1 class and 2nd product belongs to product - 2 class.
I have divided the page vertically into two parts using float:left and specified width:50% for both classes.
And also for product-2 class I have specified left:50% (to push it to left)
I have kept display:block , position:relative for both classes.
But the width property seems to not be working.
Code: https://jsfiddle.net/abhaygc/0pfygcbe/
Code Snippet:
body{
height: 100vh;
margin: 0px;
overflow: scroll;
}
.header{
background-color: white;
height:8%;
overflow: hidden;
font-style: "Roboto";
font-size: 25px;
border-bottom: 2px solid;
border-bottom-color: #cccccc;
}
#clear{
clear: both;
}
.logo{
margin-top: 12px;
float: left;
left: 0px;
padding-right: 50px;
}
#logo:hover{
background: transparent;
}
.links{
display: block;
float: right;
margin-right: 10px;
margin-top: 10px;
}
a{
position: relative;
right: 0px;
/*top: 25px;*/
padding-left: 10px;
padding-right: 10px;
color:black;
letter-spacing: 2px;
font-weight: 200;
text-decoration: none;
}
a:hover{
background-color:#cccccc;
}
.content{
display: block;
background-color: white;
height: 92%;
margin-top: 0px;
}
#clear{
clear: both;
}
.image{
display: block;
width: 200px;
height: 200px;
border-style: dashed;
border-color: red;
border-width: 2px;
overflow: hidden;
}
.product-1{
display: block;
position: relative;
padding-left: 10%;
padding-right: 10%;
margin-top: 5%;
float: left;
left: 0px;
width: 40%;
overflow: hidden;
border-style: solid;
border-color: black;
border-width: 1px;
}
.product-2{
display: block;
position: relative;
padding-left: 10%;
padding-right: 10%;
margin-top: 5%;
float: left;
left: 50%;
width: 50%;
overflow: hidden;
border-style: solid;
border-color: black;
border-width: 1px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'>
<link rel="stylesheet" type="text/css" href="products.css">
<title>Products</title>
</head>
<body>
<div class="header">
<div class="logo">
<img id="logo"src="logo.png" alt="LOGO">
</div>
<div class="links">
Home
Products
Login
Register
Contact
About
</div>
</div>
<div class="content">
<div class="product-1 product">
<div class="image">
<img src="slide-4.jpg" alt="Image 1" />
</div>
<div class="caption">
</div>
</div>
<div class="product-2 product">
<div class="image">
<img src="slide-5.jpg" alt="Image 2"/>
</div>
<div class="caption">
</div>
</div>
<div id="clear"></div>
<div class="product-1 product">
<div class="image">
<img src="slide-6.jpg" alt="Image 3"/>
</div>
<div class="caption">
</div>
</div>
<div class="product-2 product">
<div class="image">
<img src="slide-5.jpg" alt="Image 4"/>
</div>
<div class="caption">
</div>
</div>
</div>
</body>
<script type="text/javascript" src="products.js"></script>
</html>
The width in .product-2 does does not visibly work because of the left: 50% property you have assigned to it. If you remove that, then assigning a width to .product-2 will work. I have added a <div class="row"> to each of your division to distinctly divide them as a row. I assigned float-right to .product-2 and a sample width of 200px so you can see the width working. Hope this answers your question, good luck
body{
height: 100vh;
margin: 0px;
overflow: scroll;
}
.header{
background-color: white;
height:8%;
overflow: hidden;
font-style: "Roboto";
font-size: 25px;
border-bottom: 2px solid;
border-bottom-color: #cccccc;
}
#clear{
clear: both;
}
.logo{
margin-top: 12px;
float: left;
left: 0px;
padding-right: 50px;
}
#logo:hover{
background: transparent;
}
.links{
display: block;
float: right;
margin-right: 10px;
margin-top: 10px;
}
a{
position: relative;
right: 0px;
/*top: 25px;*/
padding-left: 10px;
padding-right: 10px;
color:black;
letter-spacing: 2px;
font-weight: 200;
text-decoration: none;
}
a:hover{
background-color:#cccccc;
}
.content{
display: block;
background-color: white;
height: 92%;
margin-top: 0px;
}
#clear{
clear: both;
}
.image{
display: block;
width: 200px;
height: 200px;
border-style: dashed;
border-color: red;
border-width: 2px;
overflow: hidden;
}
.product-1{
display: block;
position: relative;
padding-left: 10%;
padding-right: 10%;
margin-top: 5%;
float: left;
left: 0px;
width: 175px; /* sample width */
overflow: hidden;
border-style: solid;
border-color: black;
border-width: 1px;
}
.product-2{
display: block;
position: relative;
padding-left: 10%;
padding-right: 10%;
margin-top: 5%;
float: right;
width: 175px; /* sample width */
overflow: hidden;
border-style: solid;
border-color: black;
border-width: 1px;
}
<body>
<div class="header">
<div class="logo">
<img id="logo"src="logo.png" alt="LOGO">
</div>
<div class="links">
Home
Products
Login
Register
Contact
About
</div>
</div>
<div class="content">
<div class="row">
<div class="product-1 product">
<div class="image">
<img src="slide-4.jpg" alt="Image 1" />
</div>
<div class="caption">
</div>
</div>
<div class="product-2 product">
<div class="image">
<img src="slide-5.jpg" alt="Image 2"/>
</div>
<div class="caption">
</div>
</div>
</div>
<div id="clear"></div>
<div class="row">
<div class="product-1 product">
<div class="image">
<img src="slide-6.jpg" alt="Image 3"/>
</div>
<div class="caption">
</div>
</div>
<div class="product-2 product">
<div class="image">
<img src="slide-5.jpg" alt="Image 4"/>
</div>
<div class="caption">
</div>
</div>
</div>
</div>
</body>
body{
height: 100vh;
margin: 0px;
overflow: scroll;
}
.header{
background-color: white;
height:8%;
overflow: hidden;
font-style: "Roboto";
font-size: 25px;
border-bottom: 2px solid;
border-bottom-color: #cccccc;
}
#clear{
clear: both;
}
.logo{
margin-top: 12px;
float: left;
left: 0px;
padding-right: 50px;
}
#logo:hover{
background: transparent;
}
.links{
display: block;
float: right;
margin-right: 10px;
margin-top: 10px;
}
a{
position: relative;
right: 0px;
/*top: 25px;*/
padding-left: 10px;
padding-right: 10px;
color:black;
letter-spacing: 2px;
font-weight: 200;
text-decoration: none;
}
a:hover{
background-color:#cccccc;
}
.content{
display: block;
background-color: white;
height: 92%;
margin-top: 0px;
}
#clear{
clear: both;
}
.image{
display: block;
width: 200px;
height: 200px;
border-style: dashed;
border-color: red;
border-width: 2px;
overflow: hidden;
margin: 0 auto;
}
.product-1{
display: block;
position: relative;
/* padding-left: 10%; */
/* padding-right: 10%; */
margin-top: 5%;
float: left;
/* left: 0px; */
width: 40%;
overflow: hidden;
border-style: solid;
border-color: black;
border-width: 0;
margin: 0 5%;
margin-top: 15px;
box-sizing: border-box;
border-width:1px;
}
.product-2{
display: block;
position: relative;
/* padding-left: 10%; */
/* padding-right: 10%; */
/* margin-top: 15px; */
float: left;
/* left: 50%; */
width: 40%;
overflow: hidden;
border-style: solid;
border-color: black;
border-width: 0;
margin: 0 5%;
margin-top: 15px;
box-sizing: border-box;
border-width:1px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'>
<link rel="stylesheet" type="text/css" href="products.css">
<title>Products</title>
</head>
<body>
<div class="header">
<div class="logo">
<img id="logo"src="logo.png">
</div>
<div class="links">
Home
Products
Login
Register
Contact
About
</div>
</div>
<div class="content">
<div class="product-1 product">
<div class="image">
<img src="slide-4.jpg" alt="Image 1" />
</div>
<div class="caption">
</div>
</div>
<div class="product-2 product">
<div class="image">
<img src="slide-5.jpg" alt="Image 2"/>
</div>
<div class="caption">
</div>
</div>
<div id="clear"></div>
<div class="product-1 product">
<div class="image">
<img src="slide-6.jpg" alt="Image 3"/>
</div>
<div class="caption">
</div>
</div>
<div class="product-2 product">
<div class="image">
<img src="slide-5.jpg" alt="Image 4"/>
</div>
<div class="caption">
</div>
</div>
</div>
</body>
<script type="text/javascript" src="products.js"></script>
</html>
https://jsfiddle.net/Sampath_Madhuranga/0pfygcbe/23/
This works fine. Let me know if there is any problem.
Thanks
My main goal is to have a simple frame (as you can see) with few text lines and images. The thing I want to do, is make this frame flexible. By that I mean - if I change picture inside of it (bigger -> smaller) the frame should change. It should stay fixed.
Online editor: https://www.bootply.com/Y09Zn1wir3#
HTML:
<div class="col-md-4">
<div class="single-image-wrap">
<div class="single-image">
<div class="name">NAME</div>
<div class="img-wrap">
<img src="https://cdn.pixabay.com/photo/2013/07/12/14/07/basketball-147794_960_720.png" class="first-image">
</div>
<div class="extra-info">
<div class="bottom-text">ABC</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="single-image-wrap">
<div class="single-image">
<div class="name">NAME</div>
<div class="img-wrap">
<img src="https://cdn.pixabay.com/photo/2013/07/12/14/07/basketball-147794_960_720.png" class="second-image">
</div>
<div class="extra-info">
<div class="bottom-text">ABC</div>
</div>
</div>
</div>
</div>
CSS:
/* CSS used here will be applied after bootstrap.css */
.single-image{
border: 1px solid orange;
width: 100%;
text-align: center;
margin: 0px 0px 15px 0px;
float: right;
}
.name{
padding: 20px 0px 0px 0px;
color: black;
height: 75px;
font-size: 18px;
}
.img-wrap{
padding-bottom: 50px;
padding-top: 25px;
}
.first-image{
width: 200px;
}
.second-image{
width: 150px;
}
.extra-info{
border-top: 1px solid orange;
}
.bottom-text{
padding-top: 15px;
height: 50px;
letter-spacing: 0.1em;
}
I tried to add height property to such as:
.single-image{
...
height: 405px;
}
Result: https://www.codeply.com/go/2s2hH3nbju
But it doesn't look correct, as bottom text floats somewhere up.
I need a solution for different type of image sizes. Any ideas?
You need to set the height of .img-wrap, too.
.single-image{
border: 1px solid orange;
width: 100%;
text-align: center;
margin: 0px 0px 15px 0px;
float: right;
height: 405px;
}
.img-wrap{
padding-bottom: 50px;
padding-top: 25px;
height:250px;
overflow:hidden;
}
Try to add this new line in your css code.
.img-wrap{
min-height: 275px;
}
it will looks like this
Output
Try using flex
.single-image{
border: 1px solid orange;
width: 100%;
text-align: center;
display: flex;
flex-direction: column;
height: 100%;
justify-content: space-between;
}
.name{
padding: 20px 0px 0px 0px;
color: black;
height: 75px;
font-size: 18px;
}
.img-wrap{
padding-bottom: 50px;
padding-top: 25px;
}
.first-image{
width: 200px;
}
.second-image{
width: 150px;
}
.extra-info{
border-top: 1px solid orange;
align-self: bottom;
}
.bottom-text{
padding-top: 15px;
height: 50px;
letter-spacing: 0.1em;
}
.images-wrap{
display: flex;
}
.single-image-wrap {
height: 100%;
margin-bottom: 15px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="row images-wrap">
<div class="col-xs-6 col-md-4">
<div class="single-image-wrap">
<div class="single-image">
<div class="name">NAME</div>
<div class="img-wrap">
<img src="https://cdn.pixabay.com/photo/2013/07/12/14/07/basketball-147794_960_720.png" class="first-image">
</div>
<div class="extra-info">
<div class="bottom-text">ABC</div>
</div>
</div>
</div>
</div>
<div class="col-xs-6 col-md-4">
<div class="single-image-wrap">
<div class="single-image">
<div class="name">NAME</div>
<div class="img-wrap">
<img src="https://cdn.pixabay.com/photo/2013/07/12/14/07/basketball-147794_960_720.png" class="second-image">
</div>
<div class="extra-info">
<div class="bottom-text">ABC</div>
</div>
</div>
</div>
</div>
</div>
I'm trying to make a simple front page but suddenly I can't move my background anymore. Tried it with padding but I can't solve it. Maybe it is because I just started with codes, haha! So what I wanna do is as follows: I want to move my container> background-color: rgba(98, 97, 99, 0.25); more to the center so that it's even on both sides. For some reason the code doesn't show up correctly in here but for me it is. Maybe because I'm using Bootstrap.
body html {
margin: 0;
padding: 0;
}
.container {
background-color: rgba(98, 97, 99, 0.25);
padding-top: 4%;
}
.wrap{
width: 1090px;
}
video {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
min-width: 100%;
min-height: 100%;
z-index: -100;
}
.wowImg {
height: 255px;
width: 255px;
border-top: solid black 9px;
border-bottom: solid black 9px;
border-left: solid black 9px;
float: left;
}
.venom {
height: 255px;
width: 255px;
border-bottom: solid black 9px;
border-left: solid black 9px;
float: left;
}
.overwatch {
height: 255px;
width: 255px;
border-top: solid black 9px;
border-bottom: solid black 9px;
border-right: solid black 9px;
border-left: solid black 9px;
float: left;
}
.sum41 {
height: 255px;
width: 255px;
border-bottom: solid black 9px;
border-right: solid black 9px;
border-left: solid black 9px;
float: left;
}
.middle {
height: 510px;
width: 550px;
border-top: solid black 9px;
border-bottom: solid black 9px;
border-left: solid black 9px;
float: left;
}
.whileSheSleeps {
height: auto;
width: 540px;
border-bottom: solid black 9px;
border-left: solid black 9px;
border-right: solid black 9px;
float: left;
}
.monster {
height: 284px;
width: 250px;
border-bottom: solid black 9px;
border-left: solid black 9px;
border-right: solid black 9px;
float: left;
}
.css_awesome {
height: 284px;
width: 285px;
border-bottom: solid black 9px;
border-left: solid black 9px;
border-right: solid black 9px;
float: left;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>homepage</title>
<link href="index.css" rel="stylesheet">
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row col-md-12 wrap">
<div class="row">
<div class="col-md-12">
<div class="wrap">
<div class="row col-md-3 upperLeft">
<div class="row">
<div class="col-md-12">
<img class="wowImg"img">
<img class="venom" src="img">
</div>
</div>
</div>
<div class="col-md-6 Middle">
<div class="row">
<div class="col-md-12">
<img class="middle" src "img">
</div>
</div>
</div>
<div class="row col-md-3 upperRight">
<div class="row">
<div class="col-md-12">
<img class="overwatch" src="img">
<img class="sum41" src="img">
</div>
</div>
</div>
<div class="row col-md-6 bottomLeft">
<div class="row">
<div class="col-md-12">
<img class="whileSheSleeps" src="img">
</div>
</div>
</div>
<div class="row col-md-3 bottomMid">
<div class="row">
<div class="col-md-12">
<img class="monster" src="img">
</div>
</div>
</div>
<div class="row col-md-3 bottomRight">
<div class="row">
<div class="col-md-12">
<img class="css_awesome" src="img">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
.container {
background-color: rgba(98, 97, 99, 0.25);
padding-top: 4%;
width: 960px;
margin: 0 auto;
}
Set the container width and then left and right margin: auto;
.container {
background-color: rgba(98, 97, 99, 0.25);
padding-top: 4%;
width: 900px;
margin-left: auto;
margin-right: auto;
}
Add container float:left in css or you can add clear both
body html {
margin: 0;
padding: 0;
}
.container {
background-color: rgba(98, 97, 99, 0.25);
padding-top: 4%;
float:left;
}
.wrap{
width: 1090px;
}
video {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
min-width: 100%;
min-height: 100%;
z-index: -100;
}
.wowImg {
height: 255px;
width: 255px;
border-top: solid black 9px;
border-bottom: solid black 9px;
border-left: solid black 9px;
float: left;
}
.venom {
height: 255px;
width: 255px;
border-bottom: solid black 9px;
border-left: solid black 9px;
float: left;
}
.overwatch {
height: 255px;
width: 255px;
border-top: solid black 9px;
border-bottom: solid black 9px;
border-right: solid black 9px;
border-left: solid black 9px;
float: left;
}
.sum41 {
height: 255px;
width: 255px;
border-bottom: solid black 9px;
border-right: solid black 9px;
border-left: solid black 9px;
float: left;
}
.middle {
height: 510px;
width: 550px;
border-top: solid black 9px;
border-bottom: solid black 9px;
border-left: solid black 9px;
float: left;
}
.whileSheSleeps {
height: auto;
width: 540px;
border-bottom: solid black 9px;
border-left: solid black 9px;
border-right: solid black 9px;
float: left;
}
.monster {
height: 284px;
width: 250px;
border-bottom: solid black 9px;
border-left: solid black 9px;
border-right: solid black 9px;
float: left;
}
.css_awesome {
height: 284px;
width: 285px;
border-bottom: solid black 9px;
border-left: solid black 9px;
border-right: solid black 9px;
float: left;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>homepage</title>
<link href="index.css" rel="stylesheet">
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row col-md-12 wrap">
<div class="row">
<div class="col-md-12">
<div class="wrap">
<div class="row col-md-3 upperLeft">
<div class="row">
<div class="col-md-12">
<img class="wowImg"img">
<img class="venom" src="img">
</div>
</div>
</div>
<div class="col-md-6 Middle">
<div class="row">
<div class="col-md-12">
<img class="middle" src "img">
</div>
</div>
</div>
<div class="row col-md-3 upperRight">
<div class="row">
<div class="col-md-12">
<img class="overwatch" src="img">
<img class="sum41" src="img">
</div>
</div>
</div>
<div class="row col-md-6 bottomLeft">
<div class="row">
<div class="col-md-12">
<img class="whileSheSleeps" src="img">
</div>
</div>
</div>
<div class="row col-md-3 bottomMid">
<div class="row">
<div class="col-md-12">
<img class="monster" src="img">
</div>
</div>
</div>
<div class="row col-md-3 bottomRight">
<div class="row">
<div class="col-md-12">
<img class="css_awesome" src="img">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
I want my left div to take the width that is left, the right div has a set width that doesn't change as shown below:
HTML:
<link rel="stylesheet" type="text/css" href="css/topic.css">
<div id="topic">
<div class="post_right"></div>
<div class="post_left">
<div class="post_header">
<ul style="padding: 0px; margin: 0px; display: inline-block;">
<li>
<img src="images/eduardo_img.jpg" height="30px">
<span style="vertical-align: bottom;">Administrator</span>
</li>
<li>
Group name here
</li>
</ul>
<span style="float: right;">
<img src="images/thumb_up.png" height="30" /> 12
<img src="images/thumb_down.png" height="30" /> 2
</span>
</div>
<div class="post_body"></div>
<div class="user_signature"></div>
</div>
</div>
CSS:
#topic{
width: 100%;
overflow: hidden;
border: 1px solid;
min-height: 200px;
}
.post_left{
border: 1px solid;
overflow: hidden;
display: inline-block;
min-height: 20px;
margin: 10px;
}
.post_header{
height: 30px;
padding: 5px;
border: 1px solid;
}
.post_right{
border: 1px solid;
width: 300px;
float: right;
display: inline-block;
height: 20px;
margin: 10px;
}
.post_body{
height: 200px;
border: 1px solid;
margin: 10px;
}
.post_header li{
vertical-align: bottom;
padding-left: 10px;
padding-right: 10px;
border-right: 1px solid;
}
.post_header li:last-child{
border: 0px;
}
the div in the left takes a set width and there is a huge gap of empty space in the middle, how would i fix this? thank you!
Fixed it! all i had to do is remove the Display: inline-block; from the .post_left div
I have type of card created. It has 3 rows with a p and a div. I want both of them to come in the same line. How can I do this?
HTML:
<div class="user_card">
<div class="skills">
<p>Skills</p>
<div class="progress_wrap">
<div class="progress" style="width:95%"></div>
</div>
</div>
<div class="commitment">
<p>Commitment</p>
<div class="progress_wrap">
<div class="progress" style="width:35%;"></div>
</div>
</div>
<div class="reputation">
<p>Reputation</p>
<div class="progress_wrap">
<div class="progress" style="width:65%;"></div>
</div>
</div>
</div>
CSS:
.user_card {
background-color: #eee;
width: 30%;
padding: 10px;
}
.user_card div p {
display: inline;
}
.user_card div.skills {
margin-left: -1px;
}
.user_card div div.progress_wrap {
background-color: white;
width: 100%;
border: 1px solid #bbb;
}
.user_card div div.progress {
height: 30px;
background-color: #ddd;
}
Fiddle.
Please post fiddle as well with your answers!
Using display table, table-row, table-cell.
http://jsfiddle.net/vnama/
.user_card {
background-color: #eee;
width: 30%;
padding: 10px;
display:table;
}
.user_card p {
display: table-cell;
vertical-align:top;
line-height:30px;
padding:2px 10px 2px 2px;
}
.user_card div {
display:table-row;
padding:2px;
}
.user_card div div {
display:table-cell;
}
.user_card div div.progress_wrap {
background-color: white;
width: 100%;
border: 1px solid #bbb;
}
.user_card div div.progress {
height: 30px;
background-color: #ddd;
}
You can try using tables: http://jsbin.com/efugop
I have it:
HTML:
<div class="user_card">
<div class="skills">
<table><tr><td>
<p>Skills</p></td><td>
<div class="progress_wrap" style="margin-left:70px;">
<div class="progress" style="width:95%"></div>
</div></td></tr></table></div>
<div class="commitment">
<table><tr><td>
<p style="position:relative;margin-top:6px;">Commitment</p>
<div class="progress_wrap" style="position:relative;left:35px;margin-left:70px;">
<div class="progress" style="width:35%;"></div>
</div></td></tr></table>
</div>
<div class="reputation">
<table><tr><td>
<p style="position:relative;margin-top:6px;">Reputation</p>
<div class="progress_wrap" style="position:relative;left:35px;margin-left:70px;">
<div class="progress" style="width:65%;"></div>
</div>
</td></tr></table>
</div>
</div>
CSS:
.user_card {
background-color: #eee;
width: 50%;
padding: 20px 80px 20px 20px;
}
.user_card div p {
display: inline;
float: left;
}
.user_card div.skills {
margin-left: -1px;
}
.user_card div div.progress_wrap {
background-color: white;
width: 100px;
border: 1px solid #bbb;
}
.user_card div div.progress {
height: 30px;
background-color: #ddd;
}
You can use css to float left
. progress_wrap {
float: right;
}
HTML
<div class="user_card">
<div class="skills">
<p>Skills</p>
<div class="progress_wrap" style="margin-left:80px;">
<div class="progress" style="width:95%"></div>
</div>
</div>
<div class="commitment">
<p style="margin-left:-35px;">Commitment</p>
<div class="progress_wrap" style="margin-left:80px;">
<div class="progress" style="width:35%;"></div>
</div>
</div>
<div class="reputation">
<p style="margin-left:-73px;">Reputation</p>
<div class="progress_wrap" style="margin-left:80px;">
<div class="progress" style="width:65%;"></div>
</div>
</div>
In CSS
.user_card {
background-color: #eee;
width: 50%;
padding: 20px 100px 20px 20px;
}
.user_card div p {
display: inline;
float: left;
}
.user_card div.skills {
margin-left: -1px;
}
.user_card div div.progress_wrap {
background-color: white;
width: 100%;
border: 1px solid #bbb;
}
.user_card div div.progress {
height: 30px;
background-color: #ddd;
}