1

I tried different options in order to align elements inside a fieldset in order to keep both title, text and Learn More button on the same lines using different approaches. But the result was still negative: Align result

This is my code:

fieldset {
    height: 100%;
}
fieldset.scheduler-border {
    border: 2px solid #efefef !important;
    border-radius: 5px;
    padding: 0 1.4em 1.4em 1.4em !important;
    margin: 0 0 1.5em 0 !important;
    -webkit-box-shadow:  0px 0px 0px 0px #000;
            box-shadow:  0px 0px 0px 0px #000;
}

legend.scheduler-border {
    font-size: 0.7em !important;
    font-weight: bold !important;
    text-align: center !important;
    width:inherit; /* Or auto */
    padding:0 10px; /* To give a bit of padding on the left and right */
    border-bottom:none;
    vertical-align: sub;

}
.btn-devices{
    text-transform: none;
    background-color: #e64232;
    color: white;
}
<div class="col-md-4">
    <fieldset class="scheduler-border">
        <legend class="scheduler-border red">DEVICES</legend>
        <h3>ALL DEVICES SUPORTED</h3>
        <p class="desc-features">All our products are perfectly optimized for mobile, desktop and tablet.</p>
        <button type="button" class="btn btn-danger btn-devices">Learn More</button>
    </fieldset>
</div>

I would appreciate any possible suggestions, cause I did not find any help in information concerning this topic.

The F
  • 3,647
  • 1
  • 20
  • 28
Pavel Z.
  • 45
  • 1
  • 12

3 Answers3

1

As Paulie_D mentioned in the comment, there is no method for this but if suitable for you to define min-height then you can do the trick. Add min-height:100px for your description.

See fiddle: http://jsfiddle.net/txdbsmdh/2/

Rohit
  • 1,794
  • 1
  • 8
  • 16
  • The only issue with using `min-height` is that if you make the viewing screen smaller, the text will overflow above 100px and you will lose the alignment – JD Francis Jun 30 '16 at 20:03
  • @JdFrancis, You are talking about `max-width`? – Rohit Jun 30 '16 at 20:07
  • @Rohit No, I meant that if you collapse your screen the `

    ` with the font will extend past 100px. However I have now realized that was just in your example. Using bootstrap like he is using, it will break into columns before that happens.

    – JD Francis Jun 30 '16 at 20:11
  • Yes :) Bootstrap will take care of this :P – Rohit Jun 30 '16 at 20:15
0

I assume you mean center-aligned by your picture. By adding text-align:center to fieldset.scheduler-border you can achieve what you need.

Like this: http://jsfiddle.net/txdbsmdh/1/

EDIT: Ah, I see what you mean then. Well then the other responses are correct; there's not an "easy" way to do what you need. The easiest solution is to explicitly define the height of the elements above the buttons, either via min-height or height or by ensuring that the text is the same size. Unfortunately it's not a perfect solution and not a very responsive one. The only thing I can think of for a responsive solution (which I feel like you're looking for) is something along the lines of this: Make two parallel `<div>` colums the same height

Community
  • 1
  • 1
JD Francis
  • 454
  • 1
  • 4
  • 22
  • Thank you for your response. I meant that I want to place all the buttons on one line http://c2n.me/3zKZIkM – Pavel Z. Jun 30 '16 at 19:30
0

Check out what you expected

    <style type="text/css">
 fieldset
{
    height: 100%;
}
fieldset.scheduler-border {
    border: 2px solid #efefef !important;
    border-radius: 5px;
    padding: 0 1.4em 1.4em 1.4em !important;
    margin: 0 0 1.5em 0 !important;
    -webkit-box-shadow:  0px 0px 0px 0px #000;
            box-shadow:  0px 0px 0px 0px #000;
            display:table;
}

legend.scheduler-border {
    font-size: 0.7em !important;
    font-weight: bold !important;
    text-align: center !important;
    width:inherit; /* Or auto */
    padding:0 10px; /* To give a bit of padding on the left and right */
    border-bottom:none;
    vertical-align: sub;

}
.btn-devices{
    text-transform: none;
    background-color: #e64232;
    color: white;
}
.aligndiv {
        display: table-cell;
    vertical-align: middle;
    width: 250px;
    text-align: center
}

    </style>

<div class="col-md-4">
            <fieldset class="scheduler-border">
                <legend class="scheduler-border red">DEVICES</legend>
                <div class="aligndiv">
                    <h3>ALL DEVICES SUPORTED</h3>
                    <p class="desc-features">All our products are perfectly optimized for mobile, desktop and tablet.</p>
                    <button type="button" class="btn btn-danger btn-devices">Learn More</button>
                    </div>
            </fieldset>
        </div>
vignesh
  • 951
  • 5
  • 13