I have a web page that allows members to see and change their profile picture.
While it looks good to me, I fear that from an HTML semantics standpoint and an accessibility standpoint, I could do a better job!
The page is kind of busy, and seems to have 3 logical sections;
1.) See your current photo
2.) Decide if you want to delete your current photo OR upload a new one
3.) If you want to upload a new one, then choose the file and add a label.
Here is code for my âChange Photoâ scriptâŚ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- ################## DEBBIE ##################### -->
<!-- HTML Metadata -->
<title>Change Photo</title>
<!-- Page Stylesheets -->
<style>
form label{
display: block;
padding: 1.5em 0 0 0; /**/
font-weight: bold;
}
#changePhoto{
width: 640px;
margin: 0 auto;
padding: 30px 0 30px 0;
}
fieldset{
border: 1.5px solid #AAA; /**/
}
#changePhoto fieldset{
padding: 0 3em 2em 3em;
}
#changePhoto fieldset legend{
margin: 0 0 0 -2em;
}
form#changePhoto fieldset p#currentPhoto{
margin: 20px 0 0 0;
padding: 5px 0px 0px 2px;
font-weight: bold;
}
form#changePhoto fieldset img{
margin: 5px 0 0 20px;
}
form#changePhoto fieldset label#photoAction{
margin: 30px 0 5px 0px;
padding: 5px 0px 0px 2px;
border-top: 1px solid #AAA;
font-weight: bold;
}
form#changePhoto fieldset label.photoAction{
display: block;
margin: 0 0 8px 15px;
padding: 0;
font-weight: normal;
}
form#changePhoto fieldset div#upload{
width: 70%;
margin: 0 0 0 60px;
padding: 10px 20px 20px 20px;
border: 1px solid #AAA; /**/
}
form#changePhoto fieldset p{
margin: 0 0 0 0px;
padding: 0 0 0 0px;
}
form#changePhoto fieldset div#upload label{
display: block;
margin: 0;
padding: 15px 0 5px 0;
}
form#changePhoto fieldset div#upload label#newPhotoLabel span{
font-weight: normal;
}
form#changePhoto fieldset input#savePhotoChanges{
margin: 2em 0 1em 20px;
}
</style>
</head>
<body>
<!-- CHANGE-PHOTO FORM -->
<form id="changePhoto" enctype="multipart/form-data"
action="" method="post">
<fieldset>
<legend>Change Photo</legend>
<!-- Display Current-Photo -->
<p id="currentPhoto">Current Photo</p>
<img src='/uploads/'
width='100'
alt='Thumbnail of DoubleDee'
title='Debbie sitting outside.' />
<!-- Choose an Action -->
<label id="photoAction" for="photoAction">Choose an action...</label>
<label class="photoAction" for="photoAction">
<input type="radio" name="photoAction" value="1" />
Do Not use a Photo
</label>
<label class="photoAction" for="photoAction">
<input type="radio" name="photoAction" value="2" checked="checked" />
Use a Custom Photo
</label>
<!-- Choose File to Upload -->
<div id="upload">
<p>For a custom photo, please...</p>
<!-- Choose New Photo -->
<label for="newPhoto">Select a Photo:</label>
<input name="newPhoto" type="file" />
<!-- Enter New Photo-Label -->
<label id="newPhotoLabel" for="newPhotoLabel">Add a Photo-Label:</label>
<input name="newPhotoLabel" type="text" maxlength="40" value="" />
</div>
<!-- Submit Form -->
<input id="savePhotoChanges" type="submit" name="savePhotoChanges" class="button" value="Save Changes"/>
</fieldset>
</form>
</body>
</html>
Could you guys please help figure out how to improve the semantics and accessibility of the web page?
I am almost thinking that I need a nested Fieldset and Legend for the âSelect a Photoâ and âAdd a Photo-Labelâ partsâŚ
Sincerely,
Debbie