?
Solved

Floating Div

Posted on 2008-11-03
2
Medium Priority
?
249 Views
Last Modified: 2013-11-19
Hi,
I want to a layout like this.
div1-div2-div3
div4-div5-div6

i use col css class form div1,div2 and div3.
after row css class for div4. it's okay. but div5 and div6 go to new line (i use col class too for div5,div6)
How can i fixed it?
Ps: I will don't use any container div. I use just css class. And it has to be cross browser.

I attach code and file.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<style>
.col {	FLOAT: left !important;	content: "."; background:red;border:yellow 1px solid;width:100px;}
.row{
	content: ".";
	background:blue;
	width:100px;
	border:yellow 1px solid;
}
</style>
<head>
</head>
<body>
<div class="col">
DIV 1
</div>
<div class="col">
DIV 2
</div>
<div class="col">
DIV 3
</div>
<div class="row">
DIV 4
</div>
<div class="col">
DIV 5
</div>
<div class="col">
DIV 6
</div>
</body>
</html>

Open in new window

0
Comment
Question by:erenpasa
[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 7

Accepted Solution

by:
Valleriani earned 1500 total points
ID: 22867007
What about this? Basicly newrow being a 'newrow' that is blank, then continuing with a new set of columns.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<style>
.col { FLOAT: left !important; content: "."; background:red;border:yellow 1px solid;width:100px;}
.newrow { clear:both; }
}
</style>
 
<body>
 
<div class="col">
DIV 1
</div>
<div class="col">
DIV 2
</div>
<div class="col">
DIV 3
</div>
<div class="newrow">
</div>
<div class="col">
DIV 4
</div>
<div class="col">
DIV 5
</div>
<div class="col">
DIV 6
</div>
 
</body>
</html>

Open in new window

0
 

Author Comment

by:erenpasa
ID: 22867310
Hi Valleriani,
You solved my problem. Thanks.
I wonder that is it best way to solution?
For example is there any way with change div4's css?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

801 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