CUTCODEDOWN
Minimalist Semantic Markup

Welcome Guest
Please Login or Register

If you have registered but not recieved your activation e-mail in a reasonable amount of time, or have issues with using the registration form, please use our Contact Form for assistance. Include both your username and the e-mail you tried to register with.

Author Topic: Input overflowing with margin - border-box problem?  (Read 359 times)

GrumpyYoungMan

  • Hero Member
  • *****
  • Posts: 792
  • Karma: +8/-0
    • Grumpy Young Man
Input overflowing with margin - border-box problem?
« on: 20 Apr 2023, 04:06:18 am »
Hello

A simple problem, but one I can not get my head around!

CodePen Demo

When the input field has a width of 100% and a margin it overflows the container as the container isn't taking into account the margin.

Any ideas any why or how to fix this issue, Please...
Trying to learn a new trick to prove old dogs can learn new ones...

Total Novice have-a go Amateur Programmer - not sure that is the right thing to say... but trying to learn...

coothead

  • Sr. Member
  • ****
  • Posts: 391
  • Karma: +89/-0
  • I smile benignly
    • coothead's stuff ~ an eclectic collection
Re: Input overflowing with margin - border-box problem?
« Reply #1 on: 20 Apr 2023, 04:31:55 am »
Hi there GYM,

change this...
Code: [Select]
#formLogin input {
    width:100%;
    max-width 100%;
    box-sizing: border-box;
    padding:0.5em 1em;
    margin: 0.5em;
}
...to this..
Code: [Select]
#formLogin input {
    width:100%;
    max-width 100%;
    box-sizing: border-box;
    padding:0.5em 1em;
    margin: 0.5em 0;
}
..and this...
Code: [Select]
fieldset {
    border:none;
}
...to this...
Code: [Select]
fieldset {
    border:none;
    padding:0 0.5em
}

Note: box-sizing  does not apply to the box's margins.

coothead
~ the original bald headed old fart ~

GrumpyYoungMan

  • Hero Member
  • *****
  • Posts: 792
  • Karma: +8/-0
    • Grumpy Young Man
Re: Input overflowing with margin - border-box problem?
« Reply #2 on: 20 Apr 2023, 04:37:19 am »
Thank you and d'oh!!!
Trying to learn a new trick to prove old dogs can learn new ones...

Total Novice have-a go Amateur Programmer - not sure that is the right thing to say... but trying to learn...

coothead

  • Sr. Member
  • ****
  • Posts: 391
  • Karma: +89/-0
  • I smile benignly
    • coothead's stuff ~ an eclectic collection
Re: Input overflowing with margin - border-box problem?
« Reply #3 on: 20 Apr 2023, 11:25:38 am »
...and d'oh!!!

You are turning self deprecation into an art form.

coothead
~ the original bald headed old fart ~

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 1057
  • Karma: +188/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: Input overflowing with margin - border-box problem?
« Reply #4 on: 28 Apr 2023, 11:20:02 am »
You are turning self deprecation into an art form.
Hey, that's my huffing job!
We are all, we are all, we are all FRIENDS! For today we're all brothers, tonight we're all friends. Our moment of peace in a war that never ends.

GrumpyYoungMan

  • Hero Member
  • *****
  • Posts: 792
  • Karma: +8/-0
    • Grumpy Young Man
Re: Input overflowing with margin - border-box problem?
« Reply #5 on: 28 Apr 2023, 01:25:23 pm »
You are turning self deprecation into an art form.
Hey, that's my huffing job!
😬🤦🏽‍♂️😂😂😂😂
Trying to learn a new trick to prove old dogs can learn new ones...

Total Novice have-a go Amateur Programmer - not sure that is the right thing to say... but trying to learn...

coothead

  • Sr. Member
  • ****
  • Posts: 391
  • Karma: +89/-0
  • I smile benignly
    • coothead's stuff ~ an eclectic collection
Re: Input overflowing with margin - border-box problem?
« Reply #6 on: 29 Apr 2023, 06:37:58 pm »
Hey, that's my huffing job!

Unfortunately, T am useless at self deprecation
and my feeble attempts always fail miserably.

coothead
~ the original bald headed old fart ~

 

SMF spam blocked by CleanTalk

Advertisement