/    Sign up×
Community /Pin to ProfileBookmark

2 columns within a child div?

I have 2 textfields and I would like a php message to display in a once empty space to the right of the textfields upon submission.

[code=php]<?php echo $error_invalid; ?>[/code]

How can I setup this space without using tables? I already have a parent and a child div like so:

[CODE]#middle_parent {
min-width:200px;
margin:5px 146px 20px 155px;
background-color:transparent;
border:1px solid black;
padding:5px;
}
#middle_child {
background-color:#FFFFFF;
padding:5px;
border:1px dotted #2966A3;
overflow: hidden;
}[/CODE]

HTML:

[code=php]<div id=”middle_parent”>
<div id=”middle_child”>
<div id=”middle_title”>- SIGN IN -</div>
<form id=”admin_signin” name=”admin_signin” method=”POST” action=”<?php echo $_SESSION[‘PHP_SELF’] ?>”>

<p class=”style1″>username: <input name=”tfUser” type=”text” class=”style1″ id=”tfUser” size=”20″ autocomplete=”off”/></p>
<p class=”style1″>password: <input name=”tfPass” type=”text” class=”style1″ id=”tfUser” size=”20″ autocomplete=”off”/></p>

<p class=”style1″><input name=”submit” type=”submit” id=”submit” value=”submit”></p>
</form>
</div><!– close middle child div –>
</div><!– close middle parent div –>[/code]

to post a comment
CSS

8 Comments(s)

Copy linkTweet thisAlerts:
@ray326Feb 27.2007 — <div><label for="tfUser">username:</label><input name="tfUser" type="text" class="style1" id="tfUser" size="20" autocomplete="off"/><span id="tfUserError">error here</span></div>

Then make tfUserError hidden unless there's an error message.
Copy linkTweet thisAlerts:
@rbraggauthorFeb 27.2007 — Good morning and thank you for your reply. This still drops the error to the next line even though there is plenty enough room to the right of the textfields.
Copy linkTweet thisAlerts:
@SoreheadFeb 27.2007 — Hi,

Im not familiar with php so il just give the logic.

[code=html]
<head>
<style>
#middle_parent {
min-width:200px;
margin:5px 146px 20px 155px;
background-color:transparent;
border:1px solid black;
padding:5px;
}
#middle_child {
background-color:#FFFFFF;

padding:5px;
border:1px dotted #2966A3;
overflow: hidden;
}


#error {
position:relative;
left:50%;
top:-100px;
border:#FF0000 1px solid;
width:150px;
}
</style>


<!--[if lte IE 6]>
<style>
.ie_pos_fix {
margin-left:-150px;
}
</style>
<![endif]-->



</head>
<body>

<div id="middle_parent">
<div id="middle_child">
<div id="middle_title">- SIGN IN -</div>
<form id="admin_signin" name="admin_signin" method="POST" action="<?php echo $_SESSION['PHP_SELF'] ?>">

<p class="style1">username: <input name="tfUser" type="text" class="style1" id="tfUser" size="20" autocomplete="off"/></p>
<p class="style1">password: <input name="tfPass" type="text" class="style1" id="tfUser" size="20" autocomplete="off"/></p>

<p class="style1"><input name="submit" type="submit" id="submit" value="submit"></p>
</form>

!! - PHP if statement, if error is true, show this div
<div id="error">
Error
</div>

</div><!-- close middle child div -->
</div><!-- close middle parent div -->
[/code]


Hope this helps
Copy linkTweet thisAlerts:
@SoreheadFeb 27.2007 — Sorry the erro div should read

<div id="error" class="ie_pos_fix">

Error

</div>

Missed the class
Copy linkTweet thisAlerts:
@rbraggauthorFeb 27.2007 — This is getting there - thank you! Would you know why the parent and child div vertically expand when the error msg is displayed to the right? Also, the IE cheat does not work. It displays 1/2 way outside the right of the parent and child divs in IE.
Copy linkTweet thisAlerts:
@SoreheadFeb 27.2007 — Hmmm strange, not sure, but you could add

margin-bottom:-20px; to the error div and adjust the ie_fix accordingly, if its much of an issue.
Copy linkTweet thisAlerts:
@SoreheadFeb 27.2007 — Is it IE7 you are testing, I dont have it on my machine in work at the mo, if it is just change the if statement to the following

<!--[if gte IE 6]>

instead of

<!--[if lte IE 6]>

that way it will cover both browsers
Copy linkTweet thisAlerts:
@ray326Feb 27.2007 — Good morning and thank you for your reply. This still drops the error to the next line even though there is plenty enough room to the right of the textfields.

Edit/Delete Message[/QUOTE]
Did you recode the mark up as suggested? It shouldn't drop down if there's really plenty of room.
Would you know why the parent and child div vertically expand when the error msg is displayed to the right?[/QUOTE]Maybe line-height of the error text.
×

Success!

Help @rbragg spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...