Adding placeholder text and labels to website form text fields in HTML

This lesson is exclusive to members

Course contents
SECTION: 4
Project 2: Bike Repair Website 6:12:48
SECTION: 6
Project 4: Bootstrap Yogurt Website 3:35:39

Questions

You need to be a member to view comments.

Join today. Cancel any time.

Sign Up

Course info

128 lessons / 17 hours 5 projects Certificate of achievement

Overview

Hi there, my name is Daniel Scott and together we’re going to learn how to build professional responsive websites. which look good on mobiles, tablets and desktop screens.

We will build 4 sites together...
  • a simple but elegant restaurant website.
  • a bike repair website. 
  • a responsive portfolio website.
  • a Bootstrap website.  

We cover everything you need to build your first website. From creating your first page through to uploading your website to the internet. We’ll use the world’s most popular (and free) web design tool called Visual Studio Code.

There are exercise files you can download and then work along with me. At the end of each video I have a downloadable version of where we are in the process so that you can compare your project with mine. This will enable you to see easily where you might have a problem.

We will delve into all the good stuff such as how to create your very own mobile burger menu from scratch learning some basic JavaScript and jQuery. 

 You will...
  • Learn how to work with responsive images and icons. and stunning full screen background images and probably one too many gradients. 
  • Learn how to create forms and to choose great fonts for your website. 
  • Learn how to work with Bootstrap 4 to easily add carousels, cards and complex looking menus. 
  • Setup a domain name with hosting so that your website is live on the internet for others to see.  

There are fun class projects for you to work on which will enable you to practice what you learn. By the end of this course you’ll have a great understanding of important web design topics like HTML5, CSS3, Flex box, Responsive design and Bootstrap.   

If that all sounds a little too fancy - don’t worry, this course is aimed at people new to web design and who have never coded before. We’ll start right at the beginning and work our way through step by step. 

Who am I? 

I’m Dan, and I’ve been building websites for about 15 years now. I am award winning instructor, and have won a MAX Master award for the last 2 years in a row at the prestigious Adobe Max conference.

Time to upgrade yourself?
Sign up for the course and let’s learn how to build responsive websites.

Course duration 16 hours 42 mins
Daniel Scott

Daniel Scott

Founder of Bring Your Own Laptop & Chief Instructor

instructor

I discovered the world of design as an art student when I stumbled upon a lab full of green & blue iMac G3’s. My initial curiosity around using the computer to create ‘art’ developed into a full-blown passion, eventually leading me to become a digital designer and founder of Bring Your Own Laptop.

Sharing and teaching are a huge part of who I am. As a certified Adobe instructor, I've had the honor of winning multiple Adobe teaching awards at their annual MAX conference. I see Bring Your Own Laptop as the supportive community I wished for when I was first starting out and intimidated by design. Through teaching, I hope to bring others along for the ride and empower my students to bring their stories, labors of love, and art into the world.
True to my Kiwi roots, I've lived in many places, and currently, I reside in Ireland with my wife and kids.

Certificates

We’re awarding certificates for this course!

Check out the How to earn your certificate video for instructions on how to earn yours and click the available certificate levels below for more information.

Downloads & Exercise files

Download Exercise Files Download Completed Files

Transcript

All right, we'll start with placeholder, and we'll do labels in a sec, because placeholder is super easy. So if I want this field here to have placeholder text, just write, 'placeholder=', and you put in your quotation marks, and then just put in whatever you want. 

Now this can be anything in here. Hit 'Save', and because we are opening and closing files, just make sure you close and then reopen your testing page. Make sure you're not working on the live one, because that's not going to adjust, or change, unless you right-click it in your Explorer, and send it online. I'm just going to close it down to make it clear, so I don't get confused. You can see there, placeholder text. When you click on it, it goes over the top, but yeah, just fills in there. So you can do it on any of these, so placeholder, I'll put in, maybe, [email protected] 'Save', and you can see there; cool, eh! 

Now a label is different, it is text that goes above it. So what we'll do is-- let's do it for the name here, so let's remove placeholder, you can have both, let's have both. Putting some spaces between it, just to make it clear, for me, mainly. 

So the label can go anywhere on the page. It can be just in front of it, sometimes just after it's more appropriate, and all it is, is label, and 'for', this is where, because these are totally separate things, the fact they were over top of each other, because we could just write a P-tag and say, actually this is a P-tag of your name. That would work, there he is there, and he kind of describes that thing, but we want this label because this has labeled this other thing. 

So, label for, and make sure you use the ID. So the label for name, because it's associated with this now, linked, and this is where you put the text for it, so this is first name. We're going to do styling a little bit later on, but you say, first name is for this. Why is this different? It's because, mainly for screen readers and accessibility. Because I can click on the first name now, and it actually, can you see, it highlighted the first name box. So it's actually connected to it, so I could have it anywhere I like. 

So I'm going to cut it and put it after my Submit button. So it's still there, but watch, when I click it, it lights up. You can never have it back here but I just wanted to show you the connection. As long as the ID matches for, then that is associated with it. We want some good practice for forms, because those can be, probably one of the hardest things for somebody that is visually impaired, that's using a screen reader, needs help with. 

Again we could do one for this, you, there, but this one just needs to make sure that-- two things, the ‘for’ is going to the ID of email, and this one's going to be email. So that's placeholders and labels. Before we go, they're all on one line, I've been ignoring. So at the moment, by default these form inputs are a type of display. What kind of display are they? They're not Block because they're all on the same line. They're Inline elements. So we want to change that.
 
Basically what we're going to do, instead of saying label, label an input or all kind of separate things, what we're going to do is create a wrapper Div tag. Div tags by default are block level. So what we're going to do is, what should we do? I'm going to wrap it around both of these, and use 'Command-Shift-P', or 'Ctrl-Shift-P'. I'll use the Wrap, and I'm going to wrap it around, I'm going to create a new Class called Input Wrapper, and because it's a Block level and it's inside of it, watch, save it. It ends up on its own line, so we don't have to do anything, and I'm going to do this because I want to style it Inline. I plan to style this later on to style the things inside of it. I could say, make all the text inside of here smaller or bigger. 

So I'm just going to reuse that a few times. So these two guys are going to go together in their own little-- 'Command-Shift-P', 'Ctrl-Shift-P', wrap. We're going to call this one, what was it called? Man, taking way too long, I'm going to copy and paste it. Same with the Submit button. Actually, because he's at the end here he doesn't need to be in his own Div, because this Div here pushes him away. All right, it's going to make it a little nicer. Actually, let's separate them out because, just because. They're too close together. We're going to do styling properly a little bit later on, but just for the moment, just for my sanity, as a Designer, I'm going to open in my CCS, not Reset, I'm going to look for styles.css. 

Move it over here, and I'm going to style, the input, wrapper, and I'm going to say, let's just have some margin. We'll do margin at the top, Margin Top. I start doing this, I get real lazy, you can see, I just put in 'ma top', and it got it. Don't know how, it's magic. I'll put in maybe 20 pixels, just. I want 'ma bottom' even, as well, not 'ma top'. Margin bottom; syntax is wrong, I guess it's right, it's all right, no, it's got a squiggly line, There you go. But, umm, so bad. All right, here we go. 

So I've got some margins underneath them, just to make it a little easier for the rest of the next videos, where we look at some of the other input ones. So we've got Text ones done, all the Submit buttons done. Let's look at the other common ones, but we'll do it in another video, I'll see you there in a sec.
  • Powered by Marvin
  • Terms of use
  • Privacy policy
  • © Bring your Own Laptop Ltd 2024