0

WHy does my page especially the Textbox and button part look out of place on a screen different than laptops or pc?

It goes out of order on tablets or 40inches screen. How to maintain it across all types?

I have used bootstrap etc and some custom css but still the textbox and button part goes out of the way.

<div id="appointments" class="appointment-main-block appointment-two-main-block">
    <div class="container">
        <div class="row topheaderMargin">
            <div class="section text-center">
                <h3 class="section-heading text-center">Select Services</h3>
            </div>

            <div class="col-md-8 col-sm-12" style="width: 100% !important">
                <div class="appointment-block">

                    <h5 class="form-heading-title"><span class="form-heading-no">1.</span>Services</h5>
                    <div class="row">

                        @using (Html.BeginForm())
                        {
                            <div class="col-sm-6">
                                @*<input type="text" class="form-control date-pick searchBox" id="appointment-date" placeholder="Appointment Date">*@
                                @Html.EditorFor(Model => Model.Booking_ID, new { htmlAttributes = new { @class = "form-control searchBox", placeholder = "Booking ID" } })
                                @Html.ValidationMessageFor(Model => Model.Booking_ID, "", new { @class = "ErrorMessages searchBox" })
                            </div>
                            <button type="button" onclick="selectService()" class="btn btn-primary pull-right searchButton">Save</button>
                        }

                    </div>
                    <div class="table-responsive">
                        <table id="tblServices" class="table table-condensed table-responsive tableBody">

                            <thead>
                                <tr>

                                    <th>S.No</th>
                                    <th>Service Name</th>
                                    <th>Service Price</th>

                                </tr>
                            </thead>
                            <tbody id="tbodytblServices"></tbody>

                        </table>
                    </div>

                </div>

            </div>
        </div>
    </div>
</div>

update:

Custom CSS:

.ErrorMessages {
    font-size: small;
    color: tomato;
}

.fa-Icons-Padding {
    padding-top: 33px;
}

.MessageStrip {
    background-color: #0891ff !important;
    color: white !important;
    text-align: center !important;
    font-family: arial !important;
    font-weight: bold !important;
}

.Container-IndexPage {
    padding-right: 0%;
    padding-left: 0%;
}

.topBar {
    background-color: #F4F4F4 !important;
}

.searchBox {
    margin-left: 73%;
    width: 60% !important;
    border-color: lightgrey !important;
}

.searchButton {
    margin-right: 29%;
}

.searchButton {
    margin-right: 28.7%
}

.AddServicesSearchButton 
{
    margin-right: 7.7%;
    margin-top: -8%;
}

.datatable-headerrow {
    background-color: #F4F4F4 !important;
}

.pagination-buttons {
    background: linear-gradient(to bottom, #0891FF 0%, #0891FF 100%) !important;
    color: white !important;
}

.searchbox-border {
    border-color: lightgrey !important;
}

.tableBody {
    font-size: 16px !important;
    font-family: calibri !important;

}

.btnCheckIn {
    margin-right: 61%;
    margin-top: 1%;
}

.btnEdit {
    color: #fff !important;
    background-color: #0891FF !important;
    /*margin-right: -670%;
margin-top: -25%;*/
}

.btnBill 
{

    margin-right: 4%;
    margin-top: -18%;
    background-color: #03C04A;
}

.btnCancel {
    color: #fff !important;
    background-color: tomato !important;
    margin-right: 27%;
    margin-top: -18%;
}

.searchButtonConfirmationCancellation {
    margin-right: 28.7%;
}

.addCustomerBtn {
    margin-left: 376%;
    margin-top: 5%;
    margin-bottom: 5%;
}

.printDiv {
    text-align: center;
    margin-bottom: 1.5%;
}

.pad-container {
    padding-top: 0% !important;
}

.table-header {
    font-size: 81%;
    font-family: arial;
}

.specialh3 
{
    text-align: center;
    text-transform: capitalize;
}

.selectColumn 
{
    margin: 11px -13px 14px !important;
}

.InvoiceTable 
{
    width: 50%;
    margin-left: 25%;
    margin-top: 1%;
    border: 1px gray dashed;
}
.Copies 
{
    margin-left: 46%;
    margin-top: 1% !important;
    font-size: 11px !important;

}

.topheaderMargin 
{
    margin-top: -5%;
}
  • What do you mean by 'out of the layout'. Pls add more details like screenshot of web page on different screens. –  May 05 '18 at 13:19
  • @BharatSahlot misplaced, chota bara –  May 05 '18 at 13:21
  • Could you add a plunkr which shows the error ? When I take your code and slightly modify it to not use asp.net tags then I get a quite correct layout ? https://embed.plnkr.co/CDDvQLhIqtDy59mZ1Nni/ Could you provide your custom css? – LukeFilewalker May 05 '18 at 13:27
  • Did you do research because this is a question asked by many people. Also this may be the possible duplicate of :- https://stackoverflow.com/questions/8733795/how-to-keep-buttons-text-and-images-relative-to-a-screens-browsers-size and https://stackoverflow.com/questions/17604311/position-relative-to-the-window –  May 05 '18 at 13:28
  • @BharatSahlot yes too much but nothing makes it correct –  May 05 '18 at 13:29
  • @LukeFilewalker even in your plunker the SAVE button is misplaced –  May 05 '18 at 13:30
  • i have updated the question with custom css –  May 05 '18 at 13:30
  • If my answer was helpfull could you please accept it? – LukeFilewalker May 08 '18 at 07:04

1 Answers1

0

As I see it, you only need to surround your button with a div that gets placed in the grid-layout correctly.

<div class="col-sm-2 col-sm-pull-4">
   <button type="button" onclick="selectService()" class="btn btn-primary pull-right searchButton">Save</button>
</div>

The button is not in a container used by the grid-layout, so it got not placed accordingly and was not using any top-level layouts defined in bootstrap.

There are different things I don't really get in your layout. I would suggest you different things. I have them consolidated in this plunker. Please take alook at it. If you got any questions please feel free to write a comment.
https://embed.plnkr.co/Q9qRsq7PdbsOjyMD2dXB/

Maybe you need to take a look at the bootstrap documentation. It should clarify many questions according the grid-layout:
https://getbootstrap.com/docs/4.0/layout/grid/

Please be advised that some of the classes used to position cols in the grid-layout have changed or got extended with the release of Bootstrap 4. If you're using an older version like bootstrap 3, take a look at the corresponding documentation.
https://getbootstrap.com/docs/3.3/

Pang
  • 9,564
  • 146
  • 81
  • 122
LukeFilewalker
  • 742
  • 9
  • 23