Click here to Skip to main content
16,021,041 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to set the fields to the correct width, in this contact form I am creating, the fields are in pill shapes (left and right side), I would like the left side to be fixed to the width of the text which is inside the field, however on the right side I would like it to be fixed to the width of 6 columns regardless of any text which is inside the field.

What I have tried:

I've tried using column widths, editing the span, div etc. I have attached the code pen with the example, could somebody help please? I can also send a screenshot of how I want it to look if my explanation isn't that good!

Test Fields - HTML[^]
Posted
Updated 24-Aug-18 5:24am
v2

1 solution

I just rewrite
/* pill box start */
style here
I added some style and removed some style in css
Please add these lines may be you will get result want to you want

.pill-green .pill-box-left {
    background-color: #367782;
    color: white;
    border: none;
    height: 32px;
    display: inline-block;
    float: left;
    width: 110px;
        padding: 0 5px;
}
.pill-box-right {
    background-color: #fff;
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
    border-left: 0;
    padding-left: 4px;
    color: white;
    width: calc(100% - 124px);
    display: inline-block;
    float: right;
    height: 32px;
}
.pill-box {
    line-height: 30px;
    border: 1px solid #000;
    margin-bottom: 20px;
    padding: 0;
    margin: 0;
    display: inline-block;
    width: 100%;
    border-radius: 2px;
}
.pill-green .pill-box-left {
    background-color: #367782;
    color: white;
    border: none;
    height: 32px;
    display: inline-block;
    float: left;
    width: 110px;
}
.pill-box-right {
    background-color: #fff;
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
    border-left: 0;
    padding-left: 4px;
    color: white;
    width: calc(100% - 124px);
    display: inline-block;
    float: right;
    height: 32px;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900