Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CSS Text area 2x2 Grid

Posted on 2012-04-04
6
Medium Priority
?
1,498 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 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

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

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.
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
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).
Suggested Courses

705 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