Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CSS Text area 2x2 Grid

Posted on 2012-04-04
6
Medium Priority
?
1,541 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
5 Comments
 
LVL 4

Accepted Solution

by:
TechHelpr08210 earned 2000 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 43

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
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.
The purpose of this video is to demonstrate how to Import and export files in WordPress. 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 : Click on Too…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

879 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