Solved

CSS alignment trouble!

Posted on 2012-04-04
2
132 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…

863 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

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now