Textarea not appearing as it should.. CSS problem?

Discussion in 'CSS' started by NateJ, Apr 15, 2013.

  1. #1
    I am trying to create a form submission page for users to send a message to one another, however, the textarea tag is not appearing as it should, however the textfield's are (both are using the same class within CSS).

    How the webpage appears right now: http://prntscr.com/10riuc

    As you can see from the screenshot above, the textfield's appear as they're meant too, however the textarea is for some unknown reason, not appearing correctly (some aspects are, border-radius etc).

    CSS used:
    .textbox {
       
        outline: none;
        border: 1px solid #000;
        resize: none;
        padding-left: 6px;
        padding-right: 6px;
       
        margin-top: 7px;
        overflow: hidden;
        width: 70%;
       
        -webkit-border-radius: 10px;
        -moz-border-radius: 10px;
        border-radius: 10px;
       
    }
    Code (markup):
    HTML/PHP used:
    <div id='message_container'>
        <div id='message_header'>Compose a Message</div>
    <div id='message_box'>
    <div class="spacer"></div>
    <? if ($submit && $type == "good"){
        echo "<div class='good'>$outcome</div>";
     
    }elseif ($submit && $type == "bad"){
        echo "<div class='bad'>$outcome</div>";
     
    }
     
    if ($rec){
        echo "<input type='text' class='textbox' name='recipient' id='recipient' value='$rec' size='58' />
    <br />";
    }elseif (!$rec){
        echo "<input type='text' class='textbox' name='recipient' id='recipient' placeholder='Enter Recipient' size='58' />
    <br />";
    }
    ?>
    <input type="text" class="textbox" name='subject' id='subject' placeholder="Enter Subject" size="58" />
    <br />
    <textarea name="message" class="textbox" id="message" cols="45" rows="12" placeholder="Enter Message"></textarea>
    <br />
    <input type="submit" name="submit" value="Send" class="button"/>
    </div>
    </div>
    Code (markup):
    Does anyone have any solution as to how I can make the textarea appear as it should?
     
    NateJ, Apr 15, 2013 IP
  2. NateJ

    NateJ Active Member

    Messages:
    240
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #2
    No worries now, I found that I had used
    id="message"
    Code (markup):
    aswell as
    class="textbox"
    Code (markup):
    and was causing complications.
     
    NateJ, Apr 15, 2013 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #3
    1) might help if you were using an Accessible form without the 'false simplicity' garbage of those placeholders. Use labels so you don't fall into that trap and have a form people can actually use.

    2) inline evaluations in a single echo might be simpler than the opening and closing PHP every blasted line nonsense.

    3) Might help if you used a numbered heading or LEGEND instead of the meaningless DIV.

    4) DIV.spacer -- REALLY? Markup to do padding's job is a bad thing.

    5) the outer wrapper should be a FORM and at least one FIELDSET, NOT a DIV. You've either got pointless/redundant DIV, or are using DIV to do FORM and FIELDSET's job.

    6) you are either using float or absolute positioning, and that's just broken/garbage coding. (Though IMHO that's kind of a given with the single quotes in the markup, meaning the server-side code is likely convoluted trash.

    7) are the only two responses for $type "good" or "bad" ? If so why check it on the IF?

    8) is submit truly a false/empty or is it null if missing -- if null, you should be using isset so you're not filling up your log with warnings.

    echo '
    <form id="messageForm">
    	<fieldset>
    		<legend><span>Compose a Message</span></legend>',(
    			(isset($submit) && (!empty($sumbit))) ? '
    			<div class="'.$type.'">'.$outcome.'</div>' :
    			''
    		),'
    		<label for="messageRecipient">Recipient:</label>
    		<input
    			type="text"
    			name="recipient"
    			id="messageRecipient"',(
    				isset($rec) && (!empty($rec)) ? '
    				value="'.$rec.'"' :
    				''
    			),'
    			size="58"
    		/>
    		<br />
    		
    		<label for="messageSubject">Subject:</label>
    		<input
    			type="text"
    			name="subject"
    			id='messageSubject"
    			size="58"
    		/>
    		<br />
    		
    		<label for="messageText">Message:</label>
    		<textarea
    			name="message"
    			id="messageText"
    			cols="45" rows="12"
    		></textarea>
    		<br />
    		
    		<input type="submit" class="submit" value="Send" />
    
    	</fieldset>
    </form>';
    Code (markup):
    Again, forgetting that placeholder nonsense for a properly built form, since it's False simplicity
    http://baymard.com/blog/false-simplicity
    http://www.webaxe.org/placeholder-attribute-is-not-a-label/

    I also suspect you are slapping $_POST values into variables for no good reason... if those are postvars being used/plugged in in certain spots, be sure to htmlspecialchars them on output.
     
    deathshadow, Apr 15, 2013 IP