Wikipedia viewer layout help


#1

Hi, I’m just looking from input from others because my brain is a little tired right now and I’m not sure if it is or isn’t, so if you could tell me: is this page centered? When you submit a search and the results come up, are they centered? I always have an odd amount of trouble with this. Thanks!


#2

Looks centered to me, and verified it’s centered.

Suggestion1: Use a Chrome browser plugin like Page Ruler so you can measure stuff on your screen.

Suggestion2: Detect for RETURN key press on your input box, and fire the method for Sumit button so user don’t have to click the button. They can just press ENTER after typing their query


#3

There’s a simpler and more idiomatic way of doing this in HTML - change the <button> to <input type="submit">, wrap all the form stuff (including both the <input type="text"> and the <input type="submit">) in a <form> element, change the trigger to the submit event of the form element, and use the event.preventDefault(); method to prevent the page from reloading.

Reading:
<form> element
<input> types
jQuery submit() method
event.preventDefault()

Pen:
The World’s Greatest Form