Form Div breaks parent div and wraps - html

I really need your help with this. For the life of me, I cannot begin to understand as to why I cannot seem to get my form DIV to properly be positioned on the right side of my 2 column layout.
See attached picture below:
Here is the HTML & CSS in question:
* {
font-family: Segoe UI;
font-size: 9pt;
}
html, body {
padding: 0;
margin: 0;
}
body {
background: rgb(187,195,203);
}
.Absolute-Center {
margin: auto;
}
#wrapper {
position:absolute;
top:50%;
left:50%;
transform: translate(-50%,-50%);
}
#layout {
height: auto;
width: 900px;
border: 1px solid rgb(112,112,112);
}
#box1 {
background: rgb(141,155,169);
color: #FFF;
padding: 3px;
font-weight: bold;
}
#box2 {
width: 100%;
background: rgb(240,240,240);
border-bottom: 1px solid rgb(180,180,180);
padding: 4px;
box-sizing: border-box;
}
#box3 {
width: 100%;
border-bottom: 1px solid rgb(180,180,180);
}
#box4 {
background: #FFF;
float: left;
width: 175px;
height: 375px;
border-right: 1px solid rgb(180,180,180);
}
#box5 {
background: rgb(240,240,240);
height: 375px;
}
#box7 {
background: rgb(240,240,240);
padding: 5px;
text-align:center;
}
#leftcolumn {
float: left;
}
#rightcolumn {
border: 0;
padding: 3px;
text-align: center;
}
.clear {
clear: both;
}
fieldset {
margin: 0;
padding: 2px;
padding-bottom: 5px;
}
div.wrapper {
width: 500px;
}
div.form {
width: 100%;
background-color: rgb(240,240,240);
border: 1px sold #000;
padding: 5px;
}
div.row {
clear: both;
padding-top: 5px;
}
div.row span.label {
float: left;
width: 50px;
text-align: right;
padding-right: 5px;
}
div.row span.formw {
float: left;
width: 200px;
text-align: left;
}
div.spacer {
clear: both;
}
span.title {
color: rgb(70,141,180);
}
input {
width: 150px;
border: 1px solid #000;
}
<div id="wrapper">
<div id="layout" class="Absolute-Center">
<div id="box1">Application Title</div>
<div id="box2">
<div id="leftcolumn"></div>
<div id="rightcolumn"></div>
<div class="clear"></div>
</div>
<div id="box3">
<!-- LEFT WINDOW PANE -->
<div id="box4">
<div id="menu_wrapper">
<ul id="menu">
<li data-show="#1">File Information</li>
<li data-show="#2">Comments</li>
</ul>
</div>
</div>
<!-- RIGHT WINDOW PANE -->
<div id="box5">
<!-- CONTENT [TAB1] -->
<div id="1" style="width: 100%;" class="hidden tab">
<div class="form">
<form>
<div style="border-bottom: 1px solid #000;" class="row"><span class="title">FILE INFORMATION</span></div>
<div class="row">
<span><b>Date Received</b></span>
</div>
<div class="row">
<span class="label">From:</span><span class="formw"><input type="text"/></span>
</div>
<div class="row">
<span class="label">To:</span><span class="formw"><input type="text"/></span>
</div>
<div class="spacer"></div>
</form>
</div>
</div>
<!-- CONTENT [TAB2] -->
<div id="2" class="hidden tab"></div>
</div>
</div>
</div>
</div>

I got it to sit in the right container by adding float:right to the form container div
Fiddle - http://jsfiddle.net/90777hu9/

It's because you float box4 left but you do not float box5 right. So it is still in the flow of the document and pushed below the float left.

Added float:left and width: 78%; to .box5 Press in the snippet the fullpage button to see it
* {
font-family: Segoe UI;
font-size: 9pt;
}
html, body {
padding: 0;
margin: 0;
}
body {
background: rgb(187,195,203);
}
.Absolute-Center {
margin: auto;
}
#wrapper {
position:absolute;
top:50%;
left:50%;
transform: translate(-50%,-50%);
}
#layout {
height: auto;
width: 900px;
border: 1px solid rgb(112,112,112);
}
#box1 {
background: rgb(141,155,169);
color: #FFF;
padding: 3px;
font-weight: bold;
}
#box2 {
width: 100%;
background: rgb(240,240,240);
border-bottom: 1px solid rgb(180,180,180);
padding: 4px;
box-sizing: border-box;
}
#box3 {
width: 100%;
border-bottom: 1px solid rgb(180,180,180);
}
#box4 {
background: #FFF;
float: left;
width: 175px;
height: 375px;
border-right: 1px solid rgb(180,180,180);
}
#box5 {
background: rgb(240,240,240);
height: 375px;
float:left;
width: 78%;
}
#box7 {
background: rgb(240,240,240);
padding: 5px;
text-align:center;
}
#leftcolumn {
float: left;
}
#rightcolumn {
border: 0;
padding: 3px;
text-align: center;
}
.clear {
clear: both;
}
fieldset {
margin: 0;
padding: 2px;
padding-bottom: 5px;
}
div.wrapper {
width: 500px;
}
div.form {
width: 100%;
background-color: rgb(240,240,240);
border: 1px sold #000;
padding: 5px;
}
div.row {
clear: both;
padding-top: 5px;
}
div.row span.label {
float: left;
width: 50px;
text-align: right;
padding-right: 5px;
}
div.row span.formw {
float: left;
width: 200px;
text-align: left;
}
div.spacer {
clear: both;
}
span.title {
color: rgb(70,141,180);
}
input {
width: 150px;
border: 1px solid #000;
}
<div id="wrapper">
<div id="layout" class="Absolute-Center">
<div id="box1">Application Title</div>
<div id="box2">
<div id="leftcolumn"></div>
<div id="rightcolumn"></div>
<div class="clear"></div>
</div>
<div id="box3">
<!-- LEFT WINDOW PANE -->
<div id="box4">
<div id="menu_wrapper">
<ul id="menu">
<li data-show="#1">File Information</li>
<li data-show="#2">Comments</li>
</ul>
</div>
</div>
<!-- RIGHT WINDOW PANE -->
<div id="box5">
<!-- CONTENT [TAB1] -->
<div id="1" style="width: 100%;" class="hidden tab">
<div class="form">
<form>
<div style="border-bottom: 1px solid #000;" class="row"><span class="title">FILE INFORMATION</span></div>
<div class="row">
<span><b>Date Received</b></span>
</div>
<div class="row">
<span class="label">From:</span><span class="formw"><input type="text"/></span>
</div>
<div class="row">
<span class="label">To:</span><span class="formw"><input type="text"/></span>
</div>
<div class="spacer"></div>
</form>
</div>
</div>
<!-- CONTENT [TAB2] -->
<div id="2" class="hidden tab"></div>
</div>
</div>
</div>
</div>

Related

positioning div elements inside each other

There is a weird downward shift of the div's on both sides of the page. Definitely something to do with relative and absolute positioning. I've heard a lot about setting the elements width and height when working with position:absolute and relative but no luck.
Is there a better way of positioning these containers inside each other also, all padding and margin is 0px (stated in body tag).
What it's supposed to look like: !https://imgur.com/a/Yol1Kf8
What I have made so far: !https://imgur.com/a/u4zU4iA
CSS:
#mid-section-container {
position: relative;
height: 800px;
width: 100%;
background-color: white;
}
.apps-container {
position: absolute;
height: 617px;
background-color: black;
}
#monthly-leaderboard {
right: 50px;
top: 50px;
}
#tournament-board {
width: 800px;
top: 50px;
left: 50px;
}
.boards-container-nav {
background-color: #363636;
border-bottom: solid 2px #25b6e6;
}
#monthly-leaderboard-header {
height: 85px;
}
#tournament-header {
width: 100%;
height: 85px;
}
.apps-content-container {
height: 80%;
margin: 0px 10px;
background-color: #252525;
border-radius: 7px;
}
#monthly-content {
width: 286px;
}
#tourn-content {
width: 780px;
}
HTML:
<div id="mid-section-container">
<div id="monthly-leaderboard" class="apps-container">
<div id="monthly-leaderboard-header" class="boards-container-nav">
<h1>Monthly Leaderboard</h1>
</div>
<div id="monthly-content" class="apps-content-container">
<div id="monthly-content-header" class="boards-content-nav">
<ul>
<li>Rank</li>
<li>User</li>
<li>Wins</li>
</ul>
</div>
<p>content goes here.</p>
<p>and here.</p>
</div>
</div>
<div id="tournament-board" class="apps-container">
<div id="tournament-header" class="boards-container-nav">
<ul>
<li>Current</li>
<li>Upcoming</li>
</ul>
</div>
<div id="tourn-content" class="apps-content-container">
<div id="tourn-content-header" class="boards-content-nav">
<ul>
<li>Platform</li>
<li>Torunament</li>
<li>Start Time</li>
<li>Teams</li>
</ul>
</div>
</div>
</div>
</div>
Try this one it is help full
#mid-section-container {
position: relative;
height: 800px;
width: 100%;
background-color: white;
}
.apps-container {
position: absolute;
height: 617px;
background-color: black;
}
#monthly-leaderboard {
right: 50px;
top: 50px;
}
#tournament-board {
width: 800px;
top: 50px;
left: 50px;
}
.boards-container-nav {
background-color: #363636;
border-bottom: solid 2px #25b6e6;
}
#monthly-leaderboard-header h1{
margin: 0;
padding: 10px 10px;
color: #FFF;
}
#tournament-header {
width: 100%;
}
.apps-content-container {
height: 80%;
margin: 0px 10px;
background-color: #252525;
border-radius: 7px;
}
#monthly-content {
width: 286px;
}
#tourn-content {
width: 780px;
}
ul li {
display: inline-block;
width: auto;
}
ul li a{
color: #FFF;
}
ul li {
color: #FFF;
}
#tournament-header ul li a{
padding: 10px 20px;
}
#tourn-content-header ul li{
padding: 10px 20px;
}
#monthly-content-header ul li{
padding: 10px 20px;
}
#monthly-content-header{
background-color: #404040;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
}
#tourn-content-header{
background-color: #404040;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
}
<div id="mid-section-container">
<div id="monthly-leaderboard" class="apps-container">
<div id="monthly-leaderboard-header" class="boards-container-nav">
<h1>Monthly Leaderboard</h1>
</div>
<div id="monthly-content" class="apps-content-container">
<div id="monthly-content-header" class="boards-content-nav">
<ul>
<li>Rank</li>
<li>User</li>
<li>Wins</li>
</ul>
</div>
<p>content goes here.</p>
<p>and here.</p>
</div>
</div>
<div id="tournament-board" class="apps-container">
<div id="tournament-header" class="boards-container-nav">
<ul>
<li>Current</li>
<li>Upcoming</li>
</ul>
</div>
<div id="tourn-content" class="apps-content-container">
<div id="tourn-content-header" class="boards-content-nav">
<ul>
<li>Platform</li>
<li>Torunament</li>
<li>Start Time</li>
<li>Teams</li>
</ul>
</div>
</div>
</div>
</div>
there is a unnecessary use of position:absolute; i have made changes in your code and removed unwanted css.
#mid-section-container {
position: relative;
height: 800px;
width: 100%;
background-color: white;
display:flex;
}
.apps-container {
height: 617px;
background-color: black;
}
.boards-container-nav {
background-color: #363636;
border-bottom: solid 2px #25b6e6;
}
#monthly-leaderboard-header {
height: 85px;
}
#tournament-header {
width: 100%;
height: 85px;
}
.apps-content-container {
height: 80%;
margin: 0px 10px;
background-color: #252525;
border-radius: 7px;
}
#tournament-board {
width: 70%;
}
#monthly-leaderboard {
width: 30%;
margin-left:20px;
}
<div id="mid-section-container">
<div id="tournament-board" class="apps-container">
<div id="tournament-header" class="boards-container-nav">
<ul>
<li>Current</li>
<li>Upcoming</li>
</ul>
</div>
<div id="tourn-content" class="apps-content-container">
<div id="tourn-content-header" class="boards-content-nav">
<ul>
<li>Platform</li>
<li>Torunament</li>
<li>Start Time</li>
<li>Teams</li>
</ul>
</div>
</div>
</div>
<div id="monthly-leaderboard" class="apps-container">
<div id="monthly-leaderboard-header" class="boards-container-nav">
<h1>Monthly Leaderboard</h1>
</div>
<div id="monthly-content" class="apps-content-container">
<div id="monthly-content-header" class="boards-content-nav">
<ul>
<li>Rank</li>
<li>User</li>
<li>Wins</li>
</ul>
</div>
<p>content goes here.</p>
<p>and here.</p>
</div>
</div>
</div>
Please update following css into your existing css. just add max-width: 1250px; you want. and margin: 0 auto;
#mid-section-container {
position: relative;
height: 800px;
width: 100%;
background-color: white;
max-width: 1250px;
margin: 0 auto;
}
add css
#mid-section-container{
display:flex;
}
#monthly-leaderboard{
width:70%;
height:100%;
}
#tournament-board{
width:30%;
height:100%;
}
also add relevant properties of flex
may be this is the best way to position divs

Aligning of block-layout

I'm trying to make a layout of blocks, like this:
Pattern design
But I get this:
Pattern made with HTML and css
Does someone know what went wrong? You would really help me out!
Plus all the borders and colors for the other blocks
Snippet Below
#blocks {
font-size: 0; /* To prevent white-space from taking space */
}
.horBlock, .verBlock {
display: inline-block;
box-sizing: border-box;
}
.horBlock {
width: 50%;
padding-top: 25%;
vertical-align: top;
}
.verBlock {
width: 25%;
padding-top: 50%;
vertical-align: top;
}
#javaBlock {
border: 10px solid red;
}
#phpBlock {
border: 10px solid green;
}
#objective-CBlock {
border: 10px solid yellow;
}
#CBlock {
border: 10px solid purple;
}
#pythonBlock {
border: 10px solid blue;
}
#jsBlock {
border: 10px solid #FF7F00;
}
<div id="blocks">
<div class="horBlock" id="javaBlock" onclick="launchInfo(); java();">
<img src="javaLogo.svg">
</div>
<div class="verBlock" id="phpBlock" onclick="launchInfo(); php();">
<img src="phpLogo.svg">
</div>
<div class="verBlock" id="objective-CBlock" onclick="launchInfo(); objectiveC();">
<img src="objective-CLogo.svg">
</div>
<div class="verBlock" id="CBlock" onclick="launchInfo(); C();">
<img src="CLogo.svg">
</div>
<div class="verBlock" id="pythonBlock" onclick="launchInfo(); python();">
<img src="pythonLogo.svg">
</div>
<div class="horBlock" id="jsBlock" onclick="launchInfo(); js();">
<img src="jsLogo.svg">
</div>
</div>
This is a situation where you actually want to be using float properties on specific elements.
Create your own utility classes and assign them to elements as required; like using a specific class to float an element left or right with corresponding classes .alignLeft and .alignRight, e.g:
<div class="horBlock alignLeft nestedBlock" id="javaBlock" onclick="launchInfo(); java();">
<img src="https://placehold.it/200x200">
</div>
<div class="verBlock alignRight nestedBlock" id="phpBlock" onclick="launchInfo(); php();">
<img src="https://placehold.it/200x200">
</div>
Code Snippet Demonstration:
* {
box-sizing: border-box;
}
#blocks {
font-size: 0;
/* To prevent white-space from taking space */
}
.horBlock,
.verBlock {
display: inline-block;
box-sizing: border-box;
}
.horBlock {
width: 50%;
padding-top: 25%;
vertical-align: top;
}
.verBlock {
width: 25%;
padding-top: 50%;
vertical-align: top;
}
#javaBlock {
border: 10px solid red;
}
#phpBlock {
border: 10px solid green;
}
#objective-CBlock {
border: 10px solid yellow;
}
#CBlock {
border: 10px solid purple;
}
#pythonBlock {
border: 10px solid blue;
}
#jsBlock {
border: 10px solid #FF7F00;
}
/* Start Additional */
.alignLeft {
float: left;
}
.alignRight {
float: right;
}
.nestedBlock {
position: relative; /* required to vertically and horizontally align nested img element */
}
.nestedBlock img {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
max-width: 100%;
max-height: 100%;
}
/* End Additional */
<div id="blocks">
<div class="horBlock alignLeft nestedBlock" id="javaBlock" onclick="launchInfo(); java();">
<img src="https://placehold.it/200x200">
</div>
<div class="verBlock alignRight nestedBlock" id="phpBlock" onclick="launchInfo(); php();">
<img src="https://placehold.it/200x200">
</div>
<div class="verBlock alignRight nestedBlock" id="objective-CBlock" onclick="launchInfo(); objectiveC();">
<img src="https://placehold.it/200x200">
</div>
<div class="verBlock alignLeft nestedBlock" id="CBlock" onclick="launchInfo(); C();">
<img src="https://placehold.it/200x200">
</div>
<div class="verBlock alignLeft nestedBlock" id="pythonBlock" onclick="launchInfo(); python();">
<img src="https://placehold.it/200x200">
</div>
<div class="horBlock alignLeft nestedBlock" id="jsBlock" onclick="launchInfo(); js();">
<img src="https://placehold.it/200x200">
</div>
</div>

CSS Menu underlaping on hover

I have a mega menu which is vertically above a div that contains image banners. When hovering over this mega menu it expands displaying content. When expanding the content goes under the images in the image banner div making them not visible. I want it to be on top of the image banner div when I hover over mega menu links.
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 0; margin: 0;
}
body {
}
.wrapperss {
font-size: 1.6em;
padding: 2em;
margin: 0 auto;
width: 95%;
background-color: white;
z-index: 999;
}
/* Navigation Bar Styling */
.navSuper {
background: white;
width: 100%;
height: 43px;
position: relative;
border: 1px solid #B2BEB5;
}
.navSuper li {
list-style: none;
float: left;
text-align: center;
width: 33%;
width: calc(100% / 3);
}
.navSuper > li > a {
color: #536267;
font-weight: bold;
font-size: .7em;
text-decoration: none;
line-height: 43px;
padding: 0 20px;
height: 43px;
text-transform: uppercase;
}
.navSuper > li:hover {
border-right: 1px solid #b2beb5;
border-left: 1px solid #b2beb5;
}
.navSuper > li:hover > div {
display: block;
}
.navSuper > li > div {
position: absolute;
left: 0;
top: 41px;
display: none;
background-color: white;
padding: 10px 10px;
box-shadow: 2px 4px 4px rgba(0,0,0,0.4);
overflow: hidden;
}
.nav-mainCustom{
width: 100%;
border: 1px solid #b2beb5;
}
.nav-dividerCustom {
display: inline-block;
width: 1.8%;
}
.nav-focus-artCustom {
display: inline-block;
width: 11.5%;
vertical-align: top;
text-align: center;
}
.nav-art-authorCustom, .nav-art-titleCustom{
display: inline-block;
padding: 10px 0px;
}
.nav-art-authorCustom {
font-size: .9em;
color: red;
}
.nav-art-titleCustom {
font-size: 1.4em;
}
.nav-art-imageCustom {
display: inline-block;
}
.nav-divider-2Custom {
display:inline-block;
width: 3.8%;
}
.nav-headlinesCustom {
display:inline-block;
width: 34.5%;
font-size: 1.2em;
font-weight: bold;
text-align: left;
padding-right: 3px;
}
.nav-headline-linkCustom {
border-bottom: 1px solid #b2beb5;
padding: 10px 0px;
}
.nav-headline-linkCustom:last-child {
border-width: 0px;
}
.nav-linksCustom{
display: inline-block;
width: 11.95%;
vertical-align: top;
text-align: left;
}
.nav-linkCustom{
/*padding-bottom: 20px; */
}
.nav-empty-cellCustom{
}
.nav-headline-linkCustom:first-child{
color: red;
}
.nav-linkCustom:first-child{
color: red;
}
<div class="wrapperss">
<ul class="navSuper">
<li>Title 1
<div class="nav-mainCustom">
<div class="nav-divider"></div>
<div class="nav-focus-artCustom">
<img class="nav-art-imageCustom" src="http://example image" alt="article image"/>
<span class="nav-art-authorCustom">Title 2</span> <br>
<span class="nav-art-titleCustom">Product 1</span>
</div>
<div class="nav-divider-2Custom"></div>
<div class="nav-focus-artCustom">
<img class="nav-art-imageCustom" src="http://exampleimage" alt="article image"/>
<span class="nav-art-authorCustom">Title 3</span><br>
<span class="nav-art-titleCustom">Product 2</span>
</div>
<div class="nav-divider-2Custom"></div>
<div class="nav-headlinesCustom">
<div class="nav-headline-linkCustom">New Products</div>
<div class="nav-headline-linkCustom">Product 1 Desctiption</div>
<div class="nav-headline-linkCustom">Product 2 Desctiption</div>
<div class="nav-headline-linkCustom">Product 3 Desctiption</div>
<div class="nav-headline-linkCustom">Product 4 Desctiption</div>
<div class="nav-headline-linkCustom">Product 5 Desctiption</div>
</div>
<div class="nav-divider-2Custom"></div>
<div class="nav-linksCustom">
<div class="nav-linkCustom">Categories</div>
<div class="nav-linkCustom">CAt 1</div>
<div class="nav-linkCustom">Cat 2</div>
<div class="nav-linkCustom">Cat 3</div>
<div class="nav-linkCustom">Cat 4</div>
</div>
<div class="nav-linksCustom">
<div class="nav-empty-cellCustom"></div>
<div class="nav-linkCustom">Test 1</div>
<div class="nav-linkCustom">Cat 5</div>
<div class="nav-linkCustom">Cat 6</div>
<div class="nav-linkCustom">Cat 7</div>
<div class="nav-linkCustom">Cat 8</div>
</div>
In .navSuper class use
z-index: 99;

Layout Messing Up When I Add Text

Well, I have a problem. I have my layout exactly as I want it, but when I add text in, the layout changes. It's kind of hard to explain, so I'm going to show pictures.
Layout Before Text:
Layout After Text:
Any help is greatly appreciated
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
.header {
color: #AEC6CF;
font-family: gabriola;
font-weight: 900;
font-size: 50px;
position: relative;
}
/* ID */
#row1 {
width: 100%;
height: 15%;
}
#row2 {
width: 100%;
height: 2.5%;
}
#row3 {
width: 100%;
height: 70%;
}
#row4 {
width: 100%;
height: 2.5%;
}
#row5 {
width: 100%;
height: 9.7%;
}
#column1 {
border-bottom: 3px solid black;
border-right: 3px solid black;
width: 20%;
height: 100%;
left: 0;
display: inline-block;
margin-right: -0.25%;
}
#column2 {
border-bottom: 3px solid black;
border-left: 3px solid black;
width: 79%;
height: 100%;
right: 0;
display: inline-block;
margin-left: -0.25%;
}
/* Misc. */
.center {
text-align: center;
}
.right {
text-align: right;
}
.left {
text-align: left;
}
.clearfix {
float: clear;
margin: 0;
padding: 0;
}
<!DOCTYPE html>
<head>
<meta charset=utf-8>
<link type="text/css" rel="stylesheet" href="stylesheet.css">
<title>Test</title>
</head>
<body>
<div id="row1">
<div id="column1" class="clearfix">
</div>
<div id="column2" class="clearfix">
<h1 class="header center">See The Problem?</h1>
</div>
</div>
<div id="row2">
<div id="column1" class="clearfix">
</div>
<div id="column2" class="clearfix">
</div>
</div>
<div id="row3">
<span id="column1" class="clearfix">
</span>
<span id="column2" class="clearfix">
</span>
</div>
<div id="row4">
<span id="column1" class="clearfix">
</span>
<span id="column2" class="clearfix">
</span>
</div>
<div id="row5">
<div id="column1" class="clearfix" style="border-bottom: 0px;">
</div>
<div id="column2" class="clearfix" style="border-bottom: 0px;">
</div>
</div>
</body>
</html>

Bringing the p and div in the same line

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;
}