Solved

Wrapper around contenter problem

Posted on 2012-03-24
4
242 Views
Last Modified: 2012-03-25
Hi, I am new to html5 and css 3 and have a strange problem. In earlier projects I sometimes put a wrapper(after the body tag) around All my content to give the design a stroke or something. Now Im trying with HTML 5, but it wont work - only if I turn off the floating that is set to the 2 div elements I have under my header section - otherwise if floating is set to e.g. left the wrapper seem to only wrap around the header. How can I go around this, because I need the floating to have the 2 elements stand next to each other.
0
Comment
Question by:RapperOnStep
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:designatedinitializer
ID: 37760952
OK. Check this out:
<html>
<head>
	<style>
		body { border:1px black dotted;}
		.floating {float:left;}
		header { border:2px blue solid;}
		#one {background:red;}
	</style>
</head>
<body>
	<header>
		This is your header
	</header>
	<div id="one" class="floating" >Div 1</div>
	<div id="two" class="floating" >Div 2</div>
</body>
</html>

Open in new window


As you can see, you can style the body element. No need for a wrapper.
0
 

Author Comment

by:RapperOnStep
ID: 37761049
Hi designatedinitializer.

Thx for your answer.

But if div 2 has a lot of tekst, it will flow under div 1. How can you avoid that? Otherwise it wont work as 2 column system...
0
 
LVL 7

Accepted Solution

by:
designatedinitializer earned 500 total points
ID: 37761344
well, that's a 2nd question...
just add width to the css rule, like this:

            .floating {float:left;width:50%;}

There you go.
0
 

Author Comment

by:RapperOnStep
ID: 37763374
off course. Silly me.

Thank you.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
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.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

821 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