-2

I'm working on a small home project based on PHP and MySQL. I can do the PHP side of things - with a lot of checking the books :-) - but the HTML side, I don't know that well. OK, so I learned it back in the 90s and could do frames, forms etc. But div and class? Still to learn. :-|

Anyway, what I want to do is to have the landing page - the index.php therefore, with nothing on it but a logo (say 100px square), and below that, two fields for 'login' and 'password' and below that, a 'submit' and 'reset' button. All of it centred horizontally and vertically on the page.

I use a default css file, so is it included there, or inline?

Many thanks.

Oldskool
  • 34,211
  • 7
  • 53
  • 66
  • 1
    Both are possible. I do realize there's a lot to learn, but SO is for problems, and you seem to know what you need to learn. So, do it. – KIKO Software Jan 08 '18 at 12:35

2 Answers2

0

Someone asked a similar question before: Flexbox: center horizontally and vertically

With flexbox vertical and horizontal centering works „out of the box“. Without it, it is also possible but you need to use some hacks like display: table-cell etc. (See https://css-tricks.com/centering-in-the-unknown/ )

So the flexbox solution would be the more clean one!

FMK
  • 1,062
  • 1
  • 14
  • 25
  • Hi. Yes, I found that question before posting, but my issue is that it doesn't actually say where that text should go. In a css file? In my index.php file? – Darren Matheson Jan 08 '18 at 12:57
  • You can either include your own css file like you include the "default" one `` or you could use inline styles on the html elements like `
    `. Maybe you should also look for a html and css tutorial to refresh you css skills since this question is fairly common and has been covered in many tutorials on html and css.
    – FMK Jan 08 '18 at 13:03
  • Here is another similar question with a working code snippet to experiment with: https://stackoverflow.com/questions/114543/how-to-horizontally-center-a-div-in-another-div?rq=1 – FMK Jan 08 '18 at 13:04
  • Here is good answer to your question: https://www.quora.com/What-is-the-best-way-for-a-beginner-to-learn-HTML-CSS – FMK Jan 08 '18 at 13:29
-1

I use a default css file, so is it included there, or inline?

In todays standards, you should use the CSS file and include it in your page like so.

<link rel="stylesheet" href="styles.css">

It should be placed between the <head> </head> tags somewhere.

ProEvilz
  • 5,310
  • 9
  • 44
  • 74
  • Sorry, sloppy language on my part. The stylesheet is referenced in index.php. I just wanted to know if the positioning of the elements on the landing page should be in the css file. – Darren Matheson Jan 08 '18 at 12:55
  • Right. Well, yes, it should be in the file and not inline – ProEvilz Jan 08 '18 at 13:09