vertical align

Hey so, I'm probably just being stupid but, I can't get my div to vertically align to the center, even made my body a flex to try and get it to work 😂 Can anyone point out what I'm doing wrong pretty please? thanks ❤️ codepen: https://codepen.io/BrightDN-the-sasster/pen/abXMqXq
BrightDN
CodePen
abXMqXq
...
120 Replies
Mannix
Mannix•13mo ago
html,body{height:100%;}
html,body{height:100%;}
clevermissfox
clevermissfox•13mo ago
I think place-content is only for grid. You prob need min-height: 100vh on body For flex you need to justify-content: center; align-items: center or use display: grid; place-content: center
Brightie
BrightieOP•13mo ago
thanks! why didn't it do this automatically? oh wait, bc default is auto and it just takes the min-height required? thanks hart, but mannix' solution did hte trick xd its prety much what you said too tho
Mannix
Mannix•13mo ago
because the body has the height of the content that is in it not the whole window
Brightie
BrightieOP•13mo ago
ahh, so it indeed does auto which means min-height required, thanks
clevermissfox
clevermissfox•13mo ago
Just don’t combine them and put height: 100vh, or you’ll have overflow. Has to be 100% if you’re putting a fixed height or has to be a min-height so you don’t get overflow
Brightie
BrightieOP•13mo ago
I mean if I were to have overflow, id just put it hidden no? but if I were to use vh shouldn't I use the dvh? to also make it work good on phones
clevermissfox
clevermissfox•13mo ago
You want to hide your content?
Brightie
BrightieOP•13mo ago
no, not what I meant you said "you'd have overflow", I responded to that, that can be fixed with overflow:hidden I know if I want to hide it I just put display:none and probably also put everything else to 0 and the like, for whatever reason
clevermissfox
clevermissfox•13mo ago
If you set a height of 100vh on your body, it’s only 100 viewport height so any content that is below the fold will overflow out of the body, because it’s fixed at the height of the viewport example 768px. Anything outside that will overflow. If you put content in your body you want to be able to see it (unless your hiding it on purpose) I think I’m confusing you. Nevermind just use height:100% or min-height: 100vh and you’ll get the centering you need. If you switch your properties to be compatible with what you’re using of course
glutonium
glutonium•13mo ago
i dont think height 100% on body works does it??
Brightie
BrightieOP•13mo ago
dont worry, I understand what you mean annyway that makes 2 pages done! visually atleast Oh, by the way, do you happen to know any third-party that handles logins? I know there are paid ones but are there by any chance any free ones? I'll probably also tie in the login to database acces, oh how fun, sql , been ages since i wrote that wonder if ill remember how it goes or'll have to refresh my memory again xd I could also write it myself but that leaves a lot of security gaps for sure so I would prefer it if there were a third party handling logins, cause otherwise I would probably put a js file in there handling the logins, which obv is easy to break all they would have to do is look at the sources used it did in fact
glutonium
glutonium•13mo ago
min-height 100vh will work but u may need to set margin 0 if the overflow annoys u like me hmm weird
Brightie
BrightieOP•13mo ago
I put margin 0 by default btw, and border-sizing:border-box & padding by default 0 too
glutonium
glutonium•13mo ago
No description
glutonium
glutonium•13mo ago
not sure how it worked for u
clevermissfox
clevermissfox•13mo ago
Height with percentages is tricky but does work on body
Brightie
BrightieOP•13mo ago
o then that mustve been the html that took the 100%
glutonium
glutonium•13mo ago
ya i like to do dat too i use css reset
clevermissfox
clevermissfox•13mo ago
You have to include html
glutonium
glutonium•13mo ago
aaah makes sense yaa i thought u ment it works only on body yaa dat makes sense
clevermissfox
clevermissfox•13mo ago
The body’s parent is html so setting both of them is what makes it work. That’s why I like min-height instead
glutonium
glutonium•13mo ago
yaa me too
Brightie
BrightieOP•13mo ago
Does any of you know of a third party that handles logins w/o charge? I may look into that netlify thing, I seen somewhere on that about it handling logins but I haven't tried it out yet I would prefer it being a free service tho, cause my work ain't paying me to make this xD I'm simply making this bc my workplace is struggling with keeping track of what's expiring n we losin lots of money due to it, so im making this to help out but i would need it to be secure ofc, ain't no way this data should be hanging out for everyone to see and change as they please
glutonium
glutonium•13mo ago
welp!! out of MY working knowledge xD
Brightie
BrightieOP•13mo ago
:( dammit I mean I wrote one myself, that works but extremily insecure as its literally just a javascript file with an array of objects containing usernames & passwords and then its just running a forEach(element => element.match("inputUsername") an so on which is easily just retraceable in the sources used on f12
glutonium
glutonium•13mo ago
i mean idk wut u actually ment by handling login w/o wut does dat mean like keeping track of users and their data or something??
Brightie
BrightieOP•13mo ago
Basically, authentication you need to login to enter the page like that :p
glutonium
glutonium•13mo ago
ooh
Brightie
BrightieOP•13mo ago
so it handles logins --> do the credentials match a user in the userbase
clevermissfox
clevermissfox•13mo ago
I can’t say that I do. I didn’t know netlify handles validation and security but I wouldn’t be surprised
MarkBoots
MarkBoots•13mo ago
i see something else strange in you pen. you are using name-attributes in regular divs. these are meant (mostly) for form-elements
glutonium
glutonium•13mo ago
well for dat u will first need to have a db to store data and php to work with it if i am not wrong
Brightie
BrightieOP•13mo ago
well, I could also use classes instead, would that be a better alternative? I thought maybe using names would be better well, i can use some free to use databases, obv with limitations but yh
glutonium
glutonium•13mo ago
naah class is better name is ment for form elements
clevermissfox
clevermissfox•13mo ago
Yes you’ll want to use classes. Names are for input elements like mark said and that’s only for keeping track of what is what in your form on the server side.
Brightie
BrightieOP•13mo ago
Alright, I'll use classes instead I thought using names might be better, considering it's not, I'll revert to using classes
glutonium
glutonium•13mo ago
after that, when a user first enters your site u will tell them to log in, and the use the form info via php to check if that username and password matches db
Brightie
BrightieOP•13mo ago
don't I need a server to run php code tho?
glutonium
glutonium•13mo ago
idk too much about backend so cant ans dat but what u r trying to achieve is to do with backend u should start from basics if u wanna do backend unless u already have done em
clevermissfox
clevermissfox•13mo ago
Your company probably has a db somewhere to store the existing logins that you need to be able to access
glutonium
glutonium•13mo ago
in dat case just do some research and check whats needed for authentications
Brightie
BrightieOP•13mo ago
Well I do have the basic knowledge of php
clevermissfox
clevermissfox•13mo ago
Validation is one of the annoying parts of forms and you need to have everything secure and locked down
Brightie
BrightieOP•13mo ago
issue is, here's the thing I work in a store, just a regullar employee, no higherup Soooo, there is no way they'll grant me access to their database with information of all the stores carrying their name or their server for thatm atter
glutonium
glutonium•13mo ago
well if they dont then theres no alternative way for u to authenticate user
clevermissfox
clevermissfox•13mo ago
What are you trying to accomplish with this separate site for employees to log in ?
MarkBoots
MarkBoots•13mo ago
you can look at xampp. with that you can locally run php and a mysql db
glutonium
glutonium•13mo ago
dats like, i tell u do pick a ball from a bag but u cant have access to the bag xD
clevermissfox
clevermissfox•13mo ago
Hostkoala I believe does as well
Brightie
BrightieOP•13mo ago
Oh, basically, the store I work at struggles w/ keeping track of expiry dates and I despise the app the store branch made, its unintuitive, broken A lot of backlog so i wanted to make my own to help the store out
glutonium
glutonium•13mo ago
bro code has a greay video on showing how to do dat
Brightie
BrightieOP•13mo ago
well not exactly broken but its just so unintuitive and confusing and an ightmare to use
clevermissfox
clevermissfox•13mo ago
If it’s a local app for just your branch maybe you can ask to refactor the existing one? I’m sure they’d love the free help and the login portion will have been taken care of already And even just asking shows you’re invested as an employee and wanting to improve the experience for everyone
glutonium
glutonium•13mo ago
also btw, idk if u have already been told but, use the form tag instead of div and use input with type submit or use button inside the form instead of p tag
Brightie
BrightieOP•13mo ago
I could do that yeh, but eventually I want to move away from this store and be a programmer, so I need some experience to show My manager knows that I'm not gnna stick around forever and am planning to move on someday So making a website from scratch that would help tackle a real issue is the best experience I'm also going to make a bugtracker bc thats always handy
clevermissfox
clevermissfox•13mo ago
Are you wanting to make an app or a web app
Brightie
BrightieOP•13mo ago
Web app, maybe if I feel up for it I'll branch it out further For now it's just to keep track of expiry dates, but I might eventually make it into something bigger and maybe I may also write some arduino and have a physical scanner, doesnt cost much to make but will help enormously the biggest cost there would be the arduinomotherboard xd
clevermissfox
clevermissfox•13mo ago
What is arduino? Is that something that uses your phone camera to scan bar codes and things?
Brightie
BrightieOP•13mo ago
no, it's just c+
glutonium
glutonium•13mo ago
well why not u make a full stack web compatible for your store your own and then once done u can propose that to your manager and if they like it then they'll change current site with yours and let youe site have acccess to their db if its possible
Brightie
BrightieOP•13mo ago
arduino is just c+ well, its actually just the motherboard ig xd its written in c+
No description
glutonium
glutonium•13mo ago
c+ ? or u mean c++
Brightie
BrightieOP•13mo ago
yeh, I might give that a go, first things first tho, making sure the page works and does what it intends tho xD
clevermissfox
clevermissfox•13mo ago
Oh so it would just be one physical controller ? Why not use the phone camera that every employee has in their pocket?
glutonium
glutonium•13mo ago
ya
Brightie
BrightieOP•13mo ago
Well, my manager doesn't like it when people use their phones and I know my co-workers kinda break that rule all the time nad text and such so if I make a scanner, which obv cant text and shit that issue can't become worse not sure, if my memory serves me right it should be just c+ nvm c++
glutonium
glutonium•13mo ago
i dont think c+ is a language at least never heard of one
clevermissfox
clevermissfox•13mo ago
Oh I thought the point was to use the app , but it’s something that would be referenced on a work computer. You could make your site only accessible from those computers and then only employees would have access
Brightie
BrightieOP•13mo ago
yeah, my mistake its c++ :p
clevermissfox
clevermissfox•13mo ago
I assume c++ Yeah
glutonium
glutonium•13mo ago
yup
No description
glutonium
glutonium•13mo ago
c+ sounds kind like saying c hash tag 😂
Brightie
BrightieOP•13mo ago
Here's the thing; the web-version will always be available in the office The manager can always see it, we are allowed access to the office and the pc, so we can use it to check on expiry dates and discount them or remove them from the shelves and such The scanner will be made to make that process easier, but the scanner would also be mostly for when I decide to try and make it into a system that keeps track of the stock for that I need to keep track of what comes in and what goes out, so using a scanner can provide me with that information too as we can literally just scan whatever gets delivered
glutonium
glutonium•13mo ago
btw how much experience u got in web dev scanner as in the one to scan barcode?
Brightie
BrightieOP•13mo ago
well, I did start an education several years ago in university, but I never finished woops, so now I'm just doing things on my own yeah, well that basicaly means I'll just look for a library of a barcode reader implement that in the scanner, all I would need is an infrared reader if im not mistaken a button and a light so it's always lit up correctly
glutonium
glutonium•13mo ago
well i didnt mean it like dat but rather how much u know about web dev like for me i have firm grip on html, css and js and now i am learning framework [react] like dat
Brightie
BrightieOP•13mo ago
AH, um, not sure how to answer that if you mean the languages I know, currently I'm familiar with html css and javascript only and a small portion of arduino c++ as i made a linetracker before (a kinda car thing that follows a line) I am planning however on looking at the react.js and a small portion of php im familiar w too kinda thinking of making a few games too, that'll be a whole disaster for sure xD
glutonium
glutonium•13mo ago
hmmm i am not sure how the connection between your scanner and your whole site is to be done but sounds like its gonna be very advanced level stuff
Brightie
BrightieOP•13mo ago
Well, the site will be one thing Its purpose is to: --> keep track of expiry dates --> Expantion: keep track of inventory and also help with ordering With the expantion comes the use of the scanner the scanner will be connected to the wifi which'll ensure it can connect to everything it needs to and do its thing
glutonium
glutonium•13mo ago
k got it well m asking cause if u ARE plannin got make a full stack app then u should have a very good experience and idea from fundamentals to advance concepts so its better for u to later on upgrade your app
Brightie
BrightieOP•13mo ago
Yeah,I'm also planning on making a "demo" of the website that I can show to potential businesses in interviews (one that's not connected to the database in use and such) so upgrading the app is something that I'll constantly think of doing wheneverpossible and rewriting code too if I come to know something much more advanced or more secure or faster
glutonium
glutonium•13mo ago
well considering that u have done projects like the car that follows a line, i guess wont be too hard for u i just dont have any idea about those fields so no can tell xD
Brightie
BrightieOP•13mo ago
that's okayy I'm glad it's not in c#, last time I was writing c# Ijust got so lost in how everyting is connected like sometimes it made sense and othertimes i was like how tf are you connected
glutonium
glutonium•13mo ago
yaa so makes sure u have practiced enough all the things that u will be using from simple html to frameworks to db if i learn c# i'll learn it for game dev
Brightie
BrightieOP•13mo ago
yeh, eventually when ive mastered or well, gotten the knowledge of react.js I may actually rewrite my project in react too coincidence i want to make a few games 😂 about 7
glutonium
glutonium•13mo ago
hope u did enough js like u know working with api and stuff as well as grasping the concept of async js and similar level concepts
Brightie
BrightieOP•13mo ago
oh btw, speaking of react, recently I saw a vid on yt of an application to visually write react.js
glutonium
glutonium•13mo ago
xD i made a few games using js canvas visually write?
Brightie
BrightieOP•13mo ago
yeh, I'v worked with api's and async before
glutonium
glutonium•13mo ago
nice
clevermissfox
clevermissfox•13mo ago
Your form element should look like this <form action=“/action-page.php” method=“post” class=“login-form”> <label for=“username” class=“sr-only”>Username</label> <input type=“text” name=“username” id=“username” class=“input” placeholder=“username” required> <label for=“password” class=“sr-only”>Password</label> <input type=“password” name=“password” id=“password” class=“input” placeholder=“password” required> <button type=“submit” class=“btn”>Login</button> </form>
Brightie
BrightieOP•13mo ago
https://www.codux.com "visual ide", I don't know how else to word that than visually writing code sorry xd
Codux
Codux | Visual IDE for React
Develop React components fluidly and faster, all in one visual IDE. Codux enables you to visually edit your own code and see changes reflected instantly, everywhere.
clevermissfox
clevermissfox•13mo ago
Even if you don’t want to show the labels, you need them in the html for accessibility reasons
Brightie
BrightieOP•13mo ago
thanks! tho for now I haven't yet written any back-end code to it yet I'm first going to make sure it looks visually okay and after that I'll change and adjust where needed to enter back-end o right, for the screenreaders right?
clevermissfox
clevermissfox•13mo ago
The class sr-only is a common class name to hide content from visual users but screen readers still give them information
glutonium
glutonium•13mo ago
so its like doing coding using gui of some sort u drag drop stuff and application does the coding under the hood for u?
Brightie
BrightieOP•13mo ago
yh something like that it looks useful tho when writing react, i havent written react before but i assuem itll be so useful like you can make the components n add them n see how they look on all sizes
glutonium
glutonium•13mo ago
u should send in
code block
code block
its easier to read dat way xD
Brightie
BrightieOP•13mo ago
n adjust the stying n everything
glutonium
glutonium•13mo ago
ya i wouldnt reccomend dats just being lazy xD if u wanna be a web dev learn the actual way xD
Brightie
BrightieOP•13mo ago
true, but I mean, even now when writing just normal css and html having to refresh your page everytime is a pain in the ass i mean i now just use a local live extention
glutonium
glutonium•13mo ago
what ide r u using
clevermissfox
clevermissfox•13mo ago
Missed a back tick
Brightie
BrightieOP•13mo ago
but still, before I always refresh my page vsc
clevermissfox
clevermissfox•13mo ago
Live server is the best
glutonium
glutonium•13mo ago
then why r u not using live extansion oki
Brightie
BrightieOP•13mo ago
I do now, but I only got knowledge of its existence recently before that I always refresh refresh refresh
glutonium
glutonium•13mo ago
tho if u use vite or making react app via doing npm creat react-app (might not be correct commpletely ) then u dont need any extension well just go to extension page and download live server
Brightie
BrightieOP•13mo ago
what's vite? is that an ide ? i havent looked into react yet, im first focussing on this...and 2 other projects that I have laying around unfinished
glutonium
glutonium•13mo ago
not ide
Brightie
BrightieOP•13mo ago
I diiiid! xd I have it since 1 month ago But I've been writing codes for maybe a year (I stopped writing after i stopped my university journey, but started again a year ago)
glutonium
glutonium•13mo ago
Fireship
YouTube
Vite in 100 Seconds
Vite is a JavaScript build tool that makes it faster and easier to build web applications. It's similar to tools like Webpack, but relies on modern browser features like ES Modules to simplify and speed-up the build process. #javascript #webdev #100SecondsOfCode 🔗 Resources Vite Docs https://vitejs.dev Vite SSR Plugin https://vite-plugin-ssr...
Brightie
BrightieOP•13mo ago
so basically, for 11 months my refresh suffered! Anyway, I'm going back to coding! ain't getting nowhere talking 😂 Thanks for the help and the conversation, been very insightful ill look at that vid later today
glutonium
glutonium•13mo ago
k great well apart from that learn how u use emmet in vsc like in vsc if u type .test#test+span.class-1.class-2>span>lorem100 and hit tab itll generate
<div class="test" id="test">
<span class="class-1 class-2">
<span> <!--100 random wprds--></span>
</span>
</div>
<div class="test" id="test">
<span class="class-1 class-2">
<span> <!--100 random wprds--></span>
</span>
</div>
it can increase your coding speed a lot top of that u can use pre processors like pug to write html faster
Brightie
BrightieOP•13mo ago
ah right, ive sen people use things like .container x4 or something and it generated 4 div's with the class container or was it written differntly?
glutonium
glutonium•13mo ago
like dis
<div class="test" id="test">
<span class="class-1 class-2">
<span> <!--100 random wprds--></span>
</span>
</div>
<div class="test" id="test">
<span class="class-1 class-2">
<span> <!--100 random wprds--></span>
</span>
</div>
in pug will be
.test#test
span.class-1.class-2
span text
.test#test
span.class-1.class-2
span text
.container*4
Brightie
BrightieOP•13mo ago
ahh so its like that thanks !
glutonium
glutonium•13mo ago
ya
sacarima (Class - 50)
sacarima (Class - 50)•12mo ago
@Brightie forgot to add height, just add height: 100vh
Want results from more Discord servers?
Add your server