Web Analytics Made Easy -
StatCounter Moving input types on website - CodingForum

Announcement

Collapse
No announcement yet.

Moving input types on website

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Moving input types on website

    Making my first html5 and css3 website. I am trying to move this code to the upper left of my website. How do I do that? Here is what I have.
    Code:
    <form>
    	First name: <br>
    	<input type = "text" name = "first name"><br>
    	Last name:<br>
    	<input type="text" name = "lastname">
    	<input type="reset">
    </form>
    	<input type = "submit">

  • #2
    Well... your code is incomplete -- and broken. If the submit isn't inside the form, it won't submit the form! It also has no value so there won't even be a button... name attributes can't have spaces in them, you have no labels around your label text, no fieldset around your user changeable fields...

    Lets drag that kicking and screaming into being valid code.

    Code:
    <form action="#" method="post" >
    	<fieldset>
    		<label for="user_firstName">First name:</label><br>
    		<input type="text" name="firstName" id="user_firstName"><br>
    		<label for="user_lastName">Last name:</label><br>
    		<input type="text" name="lastName" id="user_lastName">
    	</fieldset>
    	<div class="submitsAndHiddens">
    		<input type="reset" value="clear">
    		<input type = "submit" value="send">
    	</div>
    </form>
    There are more tags that go inside forms than just input, select, and textarea. <label> forms the semantic relationship between that text and the input it is FOR, the for="" attribute pointing at the unique ID on that input. <fieldset> is for grouping together fields the user can change or select a value from. I personally use a classed DIV for the submit/reset/hidden input since those are actions, not user configured choices/values.

    ... and as to your question, "upper left" could mean anything if we can't see the site you are trying to add this to. Left usually implies you'd want stuff to rise up next to it, so you'd code order it before the other stuff and float it left, but that depends on what that other stuff is since code order should be set by logical document structure as if style/appearance doesn't even exist.

    Since your markup should NOT be determining what things look like, that's NOT HTML's job. That's CSS' job! Your HTML should say what things are and be in a logicla order as if not only style didn't exist, really it should be organized as if HTML itself didn't exist either.
    Walk the dark path, sleep with angels, call the past for help.
    https://cutcodedown.com
    https://medium.com/@deathshadow

    Comment


    • #3
      okay thanks for the help! Yeah, so I have a index.html and css.main. That's what I am trying to do, is float it left. Right now, it's at the top of my page, how do I accomplish this?

      Comment

      Working...
      X