Jump to content

[SOLVED] DIV match size


s1yman

Recommended Posts

Assign a CSS Class to it. I.E. <div class="YOURCLASS"> </div> Then wrap those tags around what you what to be uniform with the other content.

 

Then in your css add this

 

YOURCLASS {

   height: 10px;

}

 

Or what every height you need whether in %, px, em etc. Just make sure you change YOURCLASS to what you what to call it, and you can add whatever other attributes you need to it as well.

Link to comment
Share on other sites

Can you post the snippet of code you are actually working with and the CSS for it?

 

Ok, the html;

<div class="divmain">
<div class="div0"><p></p><input name="one" type="file" class="text" value="" /><p><br /></p></div>
<div class="div1"><p></p><input name="two" type="file" class="text" value="" /><p></p></div>
<div class="div2"><p></p><textarea rows="5" name="three" class="text"></textarea><p></p></div>
</div>
<div class="divmain">
<div class="div3"><p></p><textarea rows="5" name="four" class="text"></textarea><p></p></div>
<div class="div4"><p></p><input name="five" type="file" class="text" value="" /><p></p></div>
<div class="div4"><p></p><textarea rows="5" name="five" class="text"></textarea><p></p></div>
</div>

And the CSS;

.divmain
	{
	width:100%;
	position:relative;
	}

.div0
	{
	height:100%;
	width:33%;
	float:left;
	text-align:center;
	position:relative;
	border-style:solid;
	border:solid 1px #0066FF;
	margin:1px;
	overflow:hidden;
	clear:both;
	}

.div1
	{
	height:100%;
	width:33%;
	float:left;
	text-align:center;
	position:relative;
	border:solid 1px #0066FF;
	margin:1px;
	overflow:hidden;
	}

.div2
	{
	height:100%;
	width:33%;
	float:left;
	text-align:center;
	position:relative;
	border:solid 1px #0066FF;
	margin:1px;	
	overflow:hidden;	
	}

 

(3, 4, 5 are identical to 0, 1, 2)

 

It works somewhat better in IE than FF, but for example here div 2 is text area, so it is going to be bigger than div 0 & 1, however I want them to be the same size (without restricting them in the css) to make it look neater. . . Or even if you could suggest a way to make the file input to be bigger but maintain it's normal looking looks - lol

 

I appreciate the time you taking for me on this.

Link to comment
Share on other sites

Can you post a link so I can see what it is you are trying to do. What I can see is you have two divs that are the same (div1 & div 2) so remove one of them since they are the same. Also div3 and div4 what are those? Keep in mind you can use the same div multiple times to achieve the same look. That is the simplicity of CSS.

 

I.E.

 

<div class="divmain">
<div class="div0"><input name="one" type="file" class="text" value="" /></div>
<div class="div1"><input name="two" type="file" class="text" value="" /></div>
<div class="div1"><textarea rows="5" name="three" class="text"></textarea></div>
</div>

 

 

Also I am not sure what you are trying to do with the paragraph tags. Without seeing what you are trying to do, it looks just from seeing the code that they are being used out of context. What are you trying to do with those? I probably have a better solution for you.

 

 

Link to comment
Share on other sites

It's impossible to have two flexible-height divs be the same length. But, there are ways to fake it. You want to use the faux-columns technique. Google can hook you up. Look for the article on alistapart, it spells it out well.

Link to comment
Share on other sites

no, what I was saying about the submit bar was that it does weird things in FF, like this;

 

test-1.jpg

 

but I want it to look more like this;

 

test-2.jpg

(this is just photoshop'd)

 

Do you understand what I mean about the divs being lined up now? Hope this gives a clearer understanding.

Link to comment
Share on other sites

The code is also valid XHTML as well.

 

HTML....

 

<!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" xml:lang="en" lang="en">
<head>
<meta name="generator" content="HTML Tidy for Linux (vers 1 September 2005), see www.w3.org" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Test Page</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css" />
</head>
<body>
<form enctype="multipart/form-data" id="test" name="test" method="post" action="">
<div class="divTop">
<div class="TextArea">
<textarea rows="5" cols="" name="one" class="text">
</textarea></div>
<div class="TextArea">
<textarea rows="5" cols="" name="two" class="text">
</textarea></div>
<div class="TextArea">
<div class="File"><input name="three" type="file" class="text" value="" /></div>
</div>
</div>
<div class="divBottom">
<div class="TextArea">
<textarea rows="5" cols="" name="four" class="text">
</textarea></div>
<div class="TextArea">
<textarea rows="5" cols="" name="five" class="text">
</textarea></div>
<div class="div0">
<textarea rows="5" cols="" name="six" class="text">
</textarea></div>
<div class="Submit"><input name="name" type="text" value="" /><input type="submit" value="submit" /></div>
</div>
</form>
</body>
</html>

 

CSS....

 

/* CSS Document */

.text
        {
	vertical-align:middle;
	width:250px;
	}

.divTop
	{
	width:100%;
	position:relative;
                margin-top:20px;
	}

.TextArea
	{
	height:100px;
	width:33%;
                margin-top:100px;
	float:left;
	text-align:center;
	position:relative;
	border-style:solid;
	border:solid 1px #0066FF;
	margin:1px;
	overflow:hidden;		
	}

.File
	{
	margin: 40px 0px 0px 0px;
                text-align: center;
	}

.Submit
	{
	margin-top: 20px;
                text-align: center;
	}

 

You are welcome....

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.