Solved

CSS Text area 2x2 Grid

Posted on 2012-04-04
6
1,414 Views
Last Modified: 2012-08-13
Hi all
I am wanting to do a css layout with 4 text boxes in a 2x2 grid i have been trying and have had no luck could someone please help me out, i have put a image ehat i wiould like it to look like
stuff.png
0
Comment
Question by:awolarczuk
[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
6 Comments
 
LVL 4

Accepted Solution

by:
TechHelpr08210 earned 500 total points
ID: 37809219
a css layout with 4 text boxes in a 2x2 grid

So here is what your looking for...

-  2 x 2 grid layout
-  Automatically Adusts all boxes when modifying the outer container's height and width properties.

<style>

div.box_layout {
	width:400px;		/* only adjust the width to resize all div widths */
	height:400px;		/* only adjust the height to resize all div heights */
	border:0px solid #900;
	padding:0px;
	margin:0px;
	line-height:30px;  		/* sets the padding between the rows */
}

div.text_box {
	line-height:normal;
	display:inline-block;
	width:49%; 		/* sets the number of boxes per row */
	height:49%;		/* sets the number of boxes per col */
	padding:0;
	margin:0;
	background-color:#ffffff;
	border:1px solid #F00;
}

div.box_header {
	background-color:#F00;
	color:#FFF;
	text-align:center;
}

</style>

    <div class="box_layout" >
        <div class="text_box" ><div class="box_header" > 1 </div> </div>
        <div class="text_box" ><div class="box_header" > 2 </div> </div>
        <div class="text_box" ><div class="box_header" > 3 </div> </div>
        <div class="text_box" ><div class="box_header" > 4 </div> </div>
    </div>

Open in new window

0
 

Author Comment

by:awolarczuk
ID: 37809237
thanks so much i know it is a dumb question i cant seem to see the html code ??
0
 

Author Comment

by:awolarczuk
ID: 37809277
mate this is the code i have done for this page and im not seeing much just two read boxes

<!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">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>

<style type="text/css">

div.box_layout {
	width:400px;		/* only adjust the width to resize all div widths */
	height:400px;		/* only adjust the height to resize all div heights */
	border:0px solid #900;
	padding:0px;
	margin:0px;
	line-height:30px;  		/* sets the padding between the rows */
}

div.text_box {
	line-height:normal;
	display:inline-block;
	width:49%; 		/* sets the number of boxes per row */
	height:49%;		/* sets the number of boxes per col */
	padding:0;
	margin:0;
	background-color:#ffffff;
	border:1px solid #F00;
}

div.box_header {
	background-color:#F00;
	color:#FFF;
	text-align:center;
}

</style>

  
</head>

<body>
  <div class="box_layout" >
        <div class="text_box" ><div class="box_header" > 1 </div> </div>
        <div class="text_box" ><div class="box_header" > 2 </div> </div>
        <div class="text_box" ><div class="box_header" > 3 </div> </div>
        <div class="text_box" ><div class="box_header" > 4 </div> </div>
    </div>
</body>

</html>

Open in new window

0
 
LVL 30

Expert Comment

by:LZ1
ID: 37832285
Did the code above not work?
0
 
LVL 42

Expert Comment

by:David S.
ID: 37832922
The boxes seem to all be in a single column in Firefox.

These show the technique for removing the extra space between them that's causing them to not sit next to each other:
http://hanamidesign.com/blog/display-inline-block-cross-browser-solutions/
http://www.css-101.org/articles/responsive_design/content_dictates_break-points.php
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
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.
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

617 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