Bootstrap col-xs-12 in HTML is not taking full width - html

I've created a simple button link in my page with container-fluid and row classes so that I can take utilize the whole available width of the page for the link button.
However, my code doesn't result in the button taking full width of the page. Attached is the screenshot of the said output.
Please inform me as to what I'm doing incorrectly. Thanks in advance.
[Basically what I want is that the well in the below screenshot should take 100% (or atleast 90% and centered) of the page width.]
My HTML and CSS codes are mentioned below:
My HTML Code:
<div class="container-fluid">
<div class="row">
<section id="access_list_session" class="col-sm-12">
<br/>
<p id="form-header"> Access Colleague List </p>
<br /><br /><br />
<div class="row">
<div class="hidden-xs hidden-sm col-md-4">
<i class="fa fa-5x fa-cogs" aria-hidden="true"></i>
</div>
<div class="well col-xs-12 col-sm-12 col-md-8">
<div id="form_link">
<i class="fa fa-list-alt" aria-hidden="true"></i> Click to access our Colleague List<br /> <span style="font-size: 10px; text-align:center;"">(Use of this list is subject to our Privacy Policy and other T&C)</span>
</div>
<br/>
<hr>
<p> In case of any difficulty please contact the site administrator using the form below.</p>
</div>
</div>
</section>
</div>
</div>
My CSS Code
#form_link a
{
width: 100%;
font-size: 1em;
}
.row
{
padding-top: 60px;
height: 60em;
width: 100%;
}

2 solutions IMHO :
Add in .row
.row {
margin: auto;
}
to center your block (see https://jsfiddle.net/os7frkq5/1/)
or simply delete width: 100% :
(see https://jsfiddle.net/os7frkq5/2/ )

I don't know if this is what you mean but you can try this:
<div class="container-fluid">
<section id="access_list_session" class="col-md-12">
<br/>
<p id="form-header"> Access Colleague List </p>
<br /><br /><br />
<div class="row">
<div class="hidden-xs hidden-sm col-md-4">
<i class="fa fa-5x fa-cogs" aria-hidden="true"></i>
</div>
<div class="well col-xs-12 col-sm-12 col-md-12">
<div id="form_link">
<i class="fa fa-list-alt" aria-hidden="true"></i> Click to access our Colleague List<br /> <span style="font-size: 10px; text-align:center;"">(Use of this list is subject to our Privacy Policy and other T&C)</span>
</div>
<br/>
<hr>
<p> In case of any difficulty please contact the site administrator using the form below.</p>
</div>
</section>
</div>

What you want is the a element to use block-display.
a { display: block }
Read up on the differences between inline and block elements, because it's vital to the way they're laid out.

Related

Evenly sized Bootstrap columns are not aligning correctly

I have 3 evenly sized columns within a bootstrap container class which I would like to display on the same row. (Until they all collapse simultaneously on a smaller screen) Currently, the first two columns align horizontally, but the third is positioned directly below the first. I have spent some time adjusting my CSS and html, but to no avail.
I've browsed for a relevant answer to my question, as I was sure this is quite a simple problem to fix, however I have not been able to find anything. Any solutions would be greatly appreciated.
(Bootstrap v4.4.1)
.cmsInterface {
background: yellow;
margin: 1em;
padding: 1em;
padding-top: 5em;
padding-bottom: 5em;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-lg-4 cmsInterface" id="cms1" align="center">
<h5><i class="fas fa-chevron-right"></i> Create/Edit a News Article <i class="far fa-edit"></i></h5>
</div>
<div class="col-lg-4 cmsInterface" id="cms2" align="center">
<h5><i class="fas fa-chevron-right"></i> Create/Edit an Event <i class="far fa-calendar-times"></i></h5>
</div>
<div class="col-lg-4 cmsInterface" id="cms3" align="center">
<h5><i class="fas fa-chevron-right"></i> Add/Edit Staff <i class="fas fa-user-alt"></i></h5>
</div>
</div>
</div>
A screenshot of how the code currently looks in a browser:
columns in boostrap are supposed to stick to each others , to allow margin, you may only use .col without a number, and eventually add the -lg breakpoint:
example turning : <div class="col-lg-4 cmsInterface" id="cms2" align="center"> into <div class="col-lg cmsInterface" id="cms2" align="center">
.cmsInterface {
background: yellow;
margin: 1em;
padding: 1em;
padding-top: 5em;
padding-bottom: 5em;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="row">
<div class="col-lg cmsInterface" id="cms1" align="center">
<h5><i class="fas fa-chevron-right"></i> Create/Edit a News Article <i class="far fa-edit"></i></h5>
</div>
<div class="col-lg cmsInterface" id="cms2" align="center">
<h5><i class="fas fa-chevron-right"></i> Create/Edit an Event <i class="far fa-calendar-times"></i></h5>
</div>
<div class="col-lg cmsInterface" id="cms3" align="center">
<h5><i class="fas fa-chevron-right"></i> Add/Edit Staff <i class="fas fa-user-alt"></i></h5>
</div>
</div>
</div>
Demo : https://codepen.io/gc-nomade/pen/OJPrOqW

How to can implement bootstrap widget code for custom header in WordPress?

I am working on the website, I am not a pro in bootstrap. Here is the header I have with the theme:
I want to replace the address with 3 small png images i.e BBB A+ Accredited Business and Google Partner.
Like this: (Photoshoped)
Here is the widget code:
<div class="col-xs-12 col-sm-9 col-lg-10 start-xs start-sm">
<aside id="text-3" class="widget header-right widget_text">
<div class="textwidget">
<div class="container extra-info">
<div class="row">
<div class="col-sm-5 col-md-5">
<i class="fa fa-phone"></i>
<div class="phone">
<h3>1-775-97-377</h3>
<span>info#thememove.com</span>
</div>
</div>
<div class="col-sm-7 col-md-6">
<i class="fa fa-home"></i>
<div class="address">
<h3>14 Tottenham Court Road</h3>
<span>London, England.</span>
</div>
</div>
</div>
</div>
</div>
</aside>
</div>
Will you please let me know which will be the right tags and code I can use?
I am having an issue with alignment too! col-md, I want to hide it in the mobile version (maybe col-xs)
Help will be really appreciated!
Try replacing the address contents with another row and the three divs as below. Remember the columns need to add up to 12 for the grid to work as it should.
<div class="address">
<div class="row">
<div class="col-md-4">logo here</div>
<div class="col-md-4">logo here</div>
<div class="col-md-4">logo here</div>
</div>
Also with regard to hiding columns, I know bootstrap has various ways of doing that with the adding of their classes but also look at media queries.
#media only screen and (max-width: 960px) {
.whatever {
display:none;
}
}
https://www.w3schools.com/css/css_rwd_mediaqueries.asp

Fixed number of widget display on the screen

Everyone I am try to develop a UI in which I have a list of category each category has some options.
The issue is pretty silly but not able find a correct solution for it when I expand a particular widget. the count of widget is changing which is on the left side and number widget is increased on the right side I want to fixed number widgets as shown on document is loaded. Example when widget expands is below
My code is like this given below
<div class="widget-body col-lg-12 no-padding">
<div class="row">
<div class="col-lg-6" ng-repeat="cat in category track by $index" >
<section class="widget " data-widgster-collapsed="true" style="margin-bottom:5px;margin-top:15px; ">
<header class="ui-sortable-handle" style=" border-top: 3px solid orange;">
<h5>
<span class="fw-semi-bold">{{cat.Name}}</span>
<div class="widget-controls" >
<a data-widgster="expand" title="" ng-click="show(cat.Id)" href="#" style="display: none;" data-original-title="Expand">
<i class="glyphicon glyphicon-chevron-right"></i>
</a>
<a ng-click="hide(cat.Id)" data-widgster="collapse" title="" href="#" data-original-title="Collapse">
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</h5>
</header>
<div class="widget-body">
<div class="row">
<div class="col-lg-12">
<div class="col-lg-6 checkbox" ng-repeat="opt in cat.option">
<input id="{{cat.Id}}_{{opt.id}}" type="checkbox" ng-checked="{{opt.value}}" ng-model="opt.value">
<label for="{{cat.Id}}_{{opt.id}}">{{opt.name}}</label>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
So, on expand I want 5 widgets on left and 5 on right and there position must be fixed.

Making Div relative to other content on a page

I am having a very minor issue but i have been trying to fix it for few hours with no luck at all. I have a simple page that uses bootstrap. Following is the screenshot.
In this screenshot, I had my browser window maximized. As you can see the search bar is centered well and the names of 3 favorite players in the bottom are not. Now when i make the browser window size half of it. This is what i see.
Now the search bar no longer is center and the names of favorite players are centered. This is definitely not responsive as it should be.
Problem
I have identified two issues. One is that the search bar is somehow not releative and the names of the players are not. So I tried various css by making its div to absolute and relative and messed around with padding but no luck.
I am sure i am missing something here and this might be a stupid question but it would help me because i have been stuck on this for long while now.
I have uploaded my code on BOOTPLY
Following is my HTML code:
<div class="container-fluid">
<div class="row bg-success" style="background-color: #f6f5f1;padding-top:100px; padding-bottom:100px;">
<div class="row">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-small-title">NBA</div>
</div>
</div>
<div class="row">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-title">Player Portal</div>
</div>
</div>
<!-- <div class="row">
--> <div class="col-lg-4">
<div class="searchPage-box text-left">
<form role="form" class="form-inline" ng-submit="submit()">
<div class="form-group">
<div class="row">
<div class="col-lg-4">
<input type="text" class="searchPage-input" autocomplete="off" ng-model="selected" placeholder="Search Player" typeahead="sponsor as label(sponsor) for sponsor in sponsorList
| filter:$viewValue | limitTo:12" typeahead-editable="true" typeahead-min-length="2" required="" name="sponsorName">
</div>
<div class="col-md-1">
<!-- using Bootstrap default for button -->
</div>
</div>
</div>
</form>
</div>
</div>
<!-- </div> -->
</div>
<div class="row bg-warning" style="background-color: #eeede7; padding-bottom:100px;">
<div class="row">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-favorites-title" class="row">FAVORITES</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
</div>
<!-- this favorites are hard-coded for now for purposes of demo -->
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Jordan
</div>
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Lebron
</div>
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Curry
</div>
</div>
</div>
</div>
I highly appreciate all suggestions and approaches.
do not copy, learn how it works by looking at this example
This absolute not the correct way but give you a small idea!
Any questions ?? comment away! :)
#searchPage-small-title {
color: rgba(128, 128, 128, 1);
font-size: 16px;
font-family: "Open Sans";
text-align: center;
font-weight: 700;
}
#searchPage-title {
color: rgba(128, 128, 128, 1);
font-size: 50px;
font-family: "Open Sans";
text-align: center;
}
.searchPage-box {
text-align: center;
}
.searchPage-input {
width: 80%;
border-style: solid;
border-radius: 6px;
border-color: rgba(192, 189, 178, 1);
height: 59px;
font-size: 18px;
text-indent: 32px;
}
.fa-star {
color: rgba(220, 118, 28, 1);
}
#searchPage-favorites-title {
color: rgba(128, 128, 128, 1);
font-size: 18px;
font-family: "Open Sans";
text-align: center;
font-weight: 400;
margin-top: 40px;
margin-bottom: 30px;
}
.searchPage-favorites-item {
color: rgba(128, 128, 128, 1);
font-size: 20px;
font-family: "Open Sans";
display: inline-block;
text-align: center;
font-weight: 800;
padding-top: 30px;
height: 115px;
width: 140px;
border: 1px solid #444;
margin: auto 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<div class="container-fluid">
<!--row I-->
<div class="row bg-success" style="background-color: #f6f5f1;padding-top:100px; padding-bottom:100px;">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-small-title">NBA</div>
</div>
<div class="col-lg-1">
</div>
</div>
<!--row II-->
<div class="row bg-success" style="background-color: #f6f5f1;padding-top:100px; padding-bottom:100px;">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-title">Player Portal</div>
</div>
<div class="col-lg-1">
</div>
</div>
<!-- row III -->
<div class="row" style="background-color: #eeede7; padding-bottom:100px;">
<div class="col-lg-12">
<div class="searchPage-box">
<form role="form" class="form" ng-submit="submit()">
<div class="form-group">
<input type="text" class="searchPage-input" autocomplete="off" ng-model="selected" placeholder="Search Player" typeahead="sponsor as label(sponsor) for sponsor in sponsorList
| filter:$viewValue | limitTo:12" typeahead-editable="true" typeahead-min-length="2" required="" name="sponsorName">
</div>
</form>
</div>
</div>
</div>
<!-- row IV -->
<div class="row bg-warning" style="background-color: #eeede7; padding-bottom:100px;">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-favorites-title">FAVORITES</div>
</div>
<div class="col-lg-1">
</div>
</div>
<!-- row V -->
<div class="row" style="background-color: #eeede7; padding-bottom:100px; text-align: center;">
<div class="col-lg-4 searchPage-favorites-item">
<i class="fa fa-star">Jordan</i>
</div>
<div class="col-lg-4 searchPage-favorites-item">
<i class="fa fa-star">Lebron</i>
</div>
<div class="col-lg-4 searchPage-favorites-item">
<i class="fa fa-star">Curry</i>
</div>
</div>
</div>
Edit:
The following div have the class col-lg-4 meaning the width if the available space will be 33,333333%. Also the first child of this div has text-left class. If you adjust col-lg-4 to col-lg-12 and the first child with text-left to text-center you will have the desire result.
Edit:
and alter the next css:
.searchPage-box {
/* padding-left: 590px; remove */
width: 100%;
margin-bottom: 60px;
border-radius: 0 0 0 0;
}
(from http://www.bootply.com/zYFA6mqMO1)
<div class="col-lg-4">
<div class="searchPage-box text-left">
<form role="form" class="form-inline" ng-submit="submit()">
<div class="form-group">
<div class="row">
<div class="col-lg-4">
<input type="text" class="searchPage-input" autocomplete="off" ng-model="selected" placeholder="Search Player" typeahead="sponsor as label(sponsor) for sponsor in sponsorList
| filter:$viewValue | limitTo:12" typeahead-editable="true" typeahead-min-length="2" required="" name="sponsorName">
</div>
<div class="col-md-1">
<!-- using Bootstrap default for button -->
</div>
</div>
</div>
</form>
</div>
</div>
Not at my computer now, so I will have to answer more fully in a bit, but one thing that jumps out to me: instead of having empty divs with bootstrap columns, use offsets; for example, col-lg-offset-1.
EDIT: Expanding my answer.
Here is a link to my forked version of your Bootply, showing my changes. The following is a small portion of the bootply:
<div class="row">
<div class="col-xs-10 col-xs-offset-1">
<div id="searchPage-small-title">NBA</div>
</div>
</div>
<div class="row">
<div class="col-xs-10 col-xs-offset-1">
<div id="searchPage-title">Player Portal</div>
</div>
</div>
Yuri's answer does a pretty good job of explaining the issues you're coming up against. If you're going to use Bootstrap, in general, you need to only use Bootstrap's layout classes to set your layout - adding custom positions and other things like that can really mess with the page, as you've seen.
I won't go into a detailed explanation of the changes I made, in the hopes that you can have a look and figure out what makes it work, but I do have some notes:
First, rather than lg, it's better to define at least an xs behavior, and work your way up to bigger screens. By only defining col-lg-x classes for most of your items, you're not defining a responsive layout for viewports below that size.
Second, there were a couple places where you had row classes nested directly inside other row classes. This can also cause issues. The intended method of use is
<div class="row">
<div class="col-xs-x">
<!-- if you need to define another grid inside the above div,
start another row -->
<div class="row">
</div>
</div>
</div>
Third, as I mentioned in my initial response, rather than adding empty divs with column classes (which will be collapsed automatically), use col-{size}-offset-x classes on the first div in the row (in addition to the regular col-{size}-x class). Also, related to alignment: rather than using text-align: center, you can just add bootstrap's text-center class to what you want to center.
The only issue in my version is that the favorites box overlap on a small screen - this is because of their defined size. I'll leave that to you to fix.
I hope this answer helped you, and please let me know if you have any questions about my answer.
Heres what you should note:
.searchPage-box {padding-left: 590px}
Using padding-left and setting pixels is a bad idea, because when the screen size does change, pixels don't auto change. So if you want to center it, try this:
margin-left: auto !important;
margin-right: auto !important;
display: block !important;
width: 30% !important;
Those go under
.searchPage-box
Hope I helped :)
Your div around the search bar this one:
uses your css class searchPage-box, that one is using padding left 590px
.searchPage-box {
padding-left: 590px;
width: 100%;
margin-bottom: 60px;
border-radius: 0 0 0 0;
}
This cause 590px to the left of the search bar to be unused.
<div class="container-fluid">
<div class="row bg-success" style="background-color: #f6f5f1;padding-top:100px; padding-bottom:100px;">
<div class="row">
<div class="col-lg-10 col-lg-push-1">
<div id="searchPage-small-title">NBA</div>
</div>
</div>
<div class="row">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-title">Player Portal</div>
</div>
</div>
<!-- change in code is here -->
**<div class="row">
<div class="col-lg-6 col-md-6 col-sm-4 col-md-offset-2 col-lg-offset-3 col-sm-offset-1 text-left">**
<form role="form" class="form-inline" ng-submit="submit()">
<div class="form-group">
<div class="row">
<div class="col-lg-4">
<input type="text" class="searchPage-input" autocomplete="off" ng-model="selected" placeholder="Search Player" typeahead="sponsor as label(sponsor) for sponsor in sponsorList
| filter:$viewValue | limitTo:12" typeahead-editable="true" typeahead-min-length="2" required="" name="sponsorName">
</div>
<div class="col-md-1">
<!-- using Bootstrap default for button -->
</div>
</div>
</div>
</form>
</div>
</div>
<!-- </div> -->
</div>
<div class="row bg-warning" style="background-color: #eeede7; padding-bottom:100px;">
<div class="row">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-favorites-title" class="row">FAVORITES</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
</div>
<!-- this favorites are hard-coded for now for purposes of demo -->
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Jordan
</div>
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Lebron
</div>
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Curry
</div>
</div>
</div>
</div>
You are using col-sm-2 on the footer div but you lose responsive behaviour when you set width:140px in .searchPage-favorites-item.
Remove that rule and .col-sm-4 and use .col-sm-offset-3 instead:
<div class="col-sm-2 col-sm-offset-3 searchPage-favorites-item">
<i class="fa fa-star"></i>
Jordan
</div>
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Lebron
</div>
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Curry
</div>
or better
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<div class="row">
<div class="col-sm-2 col-sm-offset-3 searchPage-favorites-item"><i class="fa fa-star"></i> Jordan</div>
<div class="col-sm-2 searchPage-favorites-item"><i class="fa fa-star"></i> Lebron</div>
<div class="col-sm-2 searchPage-favorites-item"><i class="fa fa-star"></i> Curry</div>
</div>
</div>
</div>
For what concerns your form, if you want to have it centered and you have 1 column at end row, you have to have one at the beginning too (or you set offset-1)
<div class="row">
<div class="col-lg-10 col-lg-offset-1 text-center">
<input class="searchPage-input" autocomplete="off" ng-model="selected" placeholder="Search Player" typeahead="sponsor as label(sponsor) for sponsor in sponsorList
| filter:$viewValue | limitTo:12" typeahead-editable="true" typeahead-min-length="2" required="" name="sponsorName" type="text">
</div>
<div class="col-md-1">
<!-- using Bootstrap default for button -->
</div>
</div>
Or just use .col-lg-12 on it
Remember: with bootstrap you rarely have to deal with layout positioning in your custom css, since you can obtain a lot just using its classes. You should just style colors, shadows, text and things like these

Align Text In Bootstrap Well Beside FontAwesome Icon

I'm having difficulties aligning my headline and paragraph text in a "well". The "none" you see is a class to remove specific margins and is not relevant to what I'm trying to accomplish.
Here is my code
<div class="col-md-4 none">
<div class="well none">
<i class="fa fa-user fa-4x fa-fw"></i>
<h3>Test</h3>
<p>text goes here</p>
</div>
</div>
Here's what it's doing and what I want it to do.
Thanks for your help!
I would suggest you to make slight change in your html structure and wrap your text content inside the div and set its display as inline-block
<div class="col-md-4 none">
<div class="well none">
<i class="fa fa-user fa-4x fa-fw"></i>
<div class="text">
<h3>Test</h3>
<p>text goes here</p>
</div>
</div>
</div>
and css for that additional div is
.text {
display:inline-block;
}
Js Fiddle Demo
I would do this the following way. I like to use nested rows where ever possible to keep things clean.
/** CSS **/
.well h3 {
margin-top:0px;
}
.fs48 {
font-size:48px;
}
/** HTML **/
<div class='row'>
<div class='col-md-4'>
<div class='well'>
<div class='row'>
<div class='col-xs-3 text-center'>
<span class='glyphicon glyphicon-user fs48'></span>
</div>
<div class='col-xs-9'>
<h3>Test</h3>
<p>text goes here</p>
</div>
</div>
</div>
</div>
</div>
See a working example here : http://jsfiddle.net/D2RLR/6779/
You can simply replace the glyph with the font awesome class.