Jump to content

Recommended Posts

So, I decided to do a little science project using some simple HTML and PHP as I'm 13 and got bored.  So I was doing this and realized I didn't know how to center the radio button below the image.  Here's a link to see what I've basically got so far:

 

<html>
<head>
<title> Names to Faces </title>
</head>
<body>
<p>Names to Faces (NtF) is a Science Project that was created to see if people see certain names as looking a certain way.  We will give you 15 names and 4 pictures for each name for you to choose which of those pictures matches the name.</p>

<p><strong>Question 1</strong>: Who is named Mike?</p>
<div name="answer1div">
<input type="radio" name="answer1" value="a"><img src="mike1.jpeg" /></input>
<input type="radio" name="answer1" value="b"><img src="mike2.jpeg" /></input>
<input type="radio" name="answer1" value="c"><img src="mike3.jpeg" /></input>
<input type="radio" name="answer1" value="d"><img src="mike4.jpeg" /></input>
</div>

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/147836-simple-question/
Share on other sites

Hi,

 

Do you know the exact width of the images?

 

If so I would approach like this...

 

<div class="answer1div">
<img src="mike1.jpeg" alt="mike 1" />
<img src="mike2.jpeg" alt="mike 2" />
<img src="mike3.jpeg" alt="mike 3" />
<img src="mike4.jpeg" alt="mike 4" />
<input type="radio" name="answer1" value="a" />
<input type="radio" name="answer2" value="b" />
<input type="radio" name="answer3" value="c" />
<input type="radio" name="answer4" value="d" />
</div>

 

And then use css to position the images and the radios...

 

div.answer1div img {
float: left;
}
div.answer1div input {
float: left;
margin-left: 20px;
}

 

Then adjust the margin on the inputs to the correct value based on the width of the images.

 

Hope this helps.

Link to comment
https://forums.phpfreaks.com/topic/147836-simple-question/#findComment-776116
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.