Solved

CSS alignment trouble!

Posted on 2012-04-04
2
135 Views
Last Modified: 2012-04-05
I need the Post box to be top left and the two other boxes to be on the right (doesn't matter which is top).

Currently i'm using the following CSS. I'm guessing my floats and clears are wrong but i'm not sure what they should be?

Thanks in advance!

.blogpost {
	background-color: #FFF;
	float: left;
	width: 70%;
	margin-left: 10px;
	padding: 20px;
	margin-bottom: 10px;
	box-shadow: 0 0 3px #cdcdcd;
	clear: left;
}

.blogrecent {
	background-color: #FFF;
	float: right;
	width: 27%;
	margin-left: 10px;
	padding: 20px;
	margin-bottom: 10px;
	box-shadow: 0 0 3px #cdcdcd;
}
.blogcategory {
	background-color: #FFF;
	width: 27%;
	margin-left: 10px;
	padding: 20px;
	margin-bottom: 10px;
	box-shadow: 0 0 3px #cdcdcd;
	float: right;
}

Open in new window

Screen-shot-2012-04-04-at-21.39..png
0
Comment
Question by:BrighteyesDesign
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Expert Comment

by:TechHelpr08210
ID: 37808494
I changed your padding to percentages and slightly reduced the size of the main column.

Try this code:

<style>
.blogpost {
	background-color: #FFF;
	float: left;
	width: 66%;
	margin-left: 10px;
	padding: 1%;
	margin-bottom: 10px;
	box-shadow: 0 0 3px #cdcdcd;
}

.blogrecent {
	background-color: #FFF;
	float: right;
	width: 27%;
	margin-left: 10px;
	padding: 1%;
	margin-bottom: 10px;
	box-shadow: 0 0 3px #cdcdcd;
}
.blogcategory {
	background-color: #FFF;
	width: 27%;
	margin-left: 10px;
	padding: 1%;
	margin-bottom: 10px;
	box-shadow: 0 0 3px #cdcdcd;
	float: right;
}

</style>

Open in new window



Be sure to let me know if this solution doesn't work for you.

Take care!
0
 
LVL 16

Accepted Solution

by:
HagayMandel earned 500 total points
ID: 37809484
The CSS:

<style type="text/css">
body {
margin:0px;
}
.blogpost {
	background-color: #00FF00;
	float: left;
	width: 70%;
	box-shadow: 0 0 3px #cdcdcd;
	margin-left: 1%;
	border: thin solid #9966FF;
	padding-top: 20px;
	padding-bottom: 20px;
	text-indent: 20px;
}

.blogrecent {
	background-color: #FFF;	
	margin-bottom: 10px;
	box-shadow: 0 0 3px #cdcdcd;	
	padding: 20px;
}
.blogcategory {
	background-color: #FFF;	
	box-shadow: 0 0 3px #cdcdcd;	
	padding: 20px;
}

.right_wrapper {
	float: left;
	width: 27%;	
	margin-left: 1%;
}
</style">

Open in new window


The HTML:

<div class="blogpost">blogpost</div>
<div class="right_wrapper">
<div class="blogcategory">blogcategory</div>
<div class="blogrecent">blogrecent</div>
</div>

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Why "Mobile First"? 5 62
Put check in your check box 7 25
CSS auto-height of empty div 3 67
bootstrap form validations! 1 40
When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question