Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

margins within fieldsets 2

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
I have a filedset and want the submit button to center below all fields within the fieldset.

I have applied margin:0 auto; but the button just appears left justiufied within the fieldset.

Is it possible to apply this type of margin to objects within a fieldset?

if so what am i doing wrong.

link :
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
You could try adding a "container" div within the fieldset to hold the button. Set the container div's width to 100% and then set "margin: 0 auto" on the button.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I know that if you apply the style text-align:center to the fieldset itself the submit button will center. Not sure if how that will affect the fields in your fieldset though cause I'm not sure of your contents
 
You were quite right monksnake, worked a treat without affecting any of the fieldset labels.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
As your fieldset has a fixed width (420px), and your Submit has a fixed width (80px) you can just set the left margin to be fixed
Code:
margin-left: 170px;

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
actually i'd like to put the image just below the label 'message', where the space is, only I used margin:xyz, looked fine in 1024x768 but as soon as resolution changed it went pear shaped.

Any ideas how i could do that?


"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
I'm not sure how your CSS looks, but you can at least get close to what you want if you put the Message label in a container (div) and float that div left, like the following:
Code:
<div style="float:left">
   <label for="message">Message<em>*</em></label>
   <br />
   <input type="image" src="images/submit.jpg" class="submit" title="Send Message" />
</div>

And I also see that you have <br /> tags after every label, it'd be cleaner just to remove the <br /> tags and define labels in your CSS as display:block
 
ah so is that what display:block means, like putting a <br /> on the end of it?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Yes basically. A block level element is an element that contains it's own line break. A label by default is an inline element, so by setting it to a block will negate the need for all those <br /> tags, which by most cases, aren't recommended.
 
cheers!

though that div doesn't work for the send button :-(

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
well that was weird, I had to place 2 x <br /> between the label and image before it would drop down below the message label, no amount of top margin would do it.

Then I rememberbed my good old friend clear:left; and Bingo!

Thanks again monksnake

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top