Sticky header takes up whole screen on mobile - css

Here is my site - http://soundboycrew.co.uk/
When I reduce the screen size the sticky header doesn't optimise well at all. The header takes up the whole screen.
I'm using Wordpress and a theme called Lane (Which I think is made using Bootstrap). The demos show good optimisation, but I believe something is messed up.
Is there any way I can add some custom css to resolve this issue?
Any help will be much appreciated.

I think the problem are fixed sizes. If you want it to be responsible use ems in opposite to px. The same applies to property 'right' in media queries which positioning collapsed navigation.
To place elements horizontally change size of bootstrap columns. For example:
<div id="logo" class="navbar-header col-md-2 col-sm-3 col-xs-12"></div>
<div class="email_phone col-md-5 col-sm-6 col-xs-12"></div>
<div class="col-md-5 col-sm-3 col-xs-12"></div>
and in
#media only screen and (max-width: 991px)
.responsive #logo {}
delete
margin-left: 15px;

Related

move div up on mobile using push and pull bootstrap

I am trying yo move neweyes class using push and pull on mobile screen but I am unable to do that. How can I move upside this on mobile screen?
<div>
<div class="woke-eye col-sm-12 col-md-4 col-sm-push-12">
<img id="dani1">
</div>
<div class="neweyese col-sm-12 col-md-8 col-sm-pull-12">
<img src=''/>
</div>
EDIT working fiddle
JSfiddle the wokeup eyes div should come later on mobile. now code is doing reverse , on large screen its coming later . but I need on mobile
Here's an example using your code, but modified so that it works the way you want.
<div>
<div class="neweyese col-md-4 col-md-push-8">
<img src=''/>neweyese
</div>
<div class="woke-eye col-md-8 col-md-pull-4">
<img id="dani1">woke-eye
</div>
</div>
You don't need col-sm-12, because that is the default behavior if you don't include it. Otherwise, we're essentially reversing the position of the two columns on MD and up. If the viewport is below MD, then the columns will switch to a width of 12 but since they are reversed the one on the right will be on top.
https://jsfiddle.net/6rtwyazq/12/
If I understand what you want:
You want on desktop .woke-eye to be on left side and .neweyese on right, on small screen you want .woke-eye to be below .neweyese, If so here is an updated JSfiddle, hope this helps.
Update
Check the updated JSfiddle.
Second Update
Reffering to your last comment, this is what you are looking for JSfiddle.
The following code worked for me.
#media only screen and (max-width: 767px) {
.xs-column-reverse {
display: flex;
flex-direction: column-reverse;
}
}

How to customize Angular Material Card for mobile

So I have the following desktop layout (which I am completely satisfied with):
This is my attempt to make it mobile:
I like the horizontal scroll here, but I feel that the cards are too thin; I would like to stretch my card to be more box-like (square). Ideally, the card is big enough to fill the gap between the header and the footer without causing
HTML:
<div class="page-content">
<div class="card-deck" fxLayout.xs="row" style="overflow: scroll; height:100%">
<md-card style="width:10rem;" *ngFor="let make of filteredMakes" (click)="goToModels(make.niceName)"
class="page-card mat-card">
<img md-card-image="" src="assets/img/gallery/brands/256/{{make.name}}.png" class="mat-card-image" />
<md-card-subtitle class="mat-card-title text-center">{{ make.name }}</md-card-subtitle>
</md-card>
</div>
</div>
I've tried many css tricks and tried using flexbox, but there must be something I'm missing (media queries perhaps, and how to override them).
How can I make the following styles apply ONLY to mobile?
min-height: 375px;min-width: 278px;
If anyone has any direction on how to accomplish this design, it would be greatly appreciated.
In order to get a different style for mobile, we do this:
#media (max-width: 600px) {
md-card {
min-width:17rem;
}
}

how to create margin between bootstrap columns without destroying design?

I have my simple markup
<div class="row">
<div class="col-lg-6 loginField">
data
</div>
<div class=" col-lg-6 loginField">
<div class="">
test
</div>
</div>
</div>
.loginField{
background-color:white;
}
so my problem is that i am getting 1 white line on desktop screen, but i want to make a 10 px space between those 2 columns without destroying responsive design. Right now if i switch to smaller screen it works, but on desctop there are no space, and if i add margin, this margin presist on smaller screens which is ugly.
P.S. when i say it works on smaller screens, i mean that those 2 columns move under each other and width of the white lines are as they shopuld be.
You simply need to mimic the same breakpoints in the responsive design as is in bootstrap.css:
http://jsfiddle.net/G6nWh/4/
CSS:
#media (min-width: 1200px) {
.margin-left-10 { margin-left: 10px; }
}
HTML:
<div class="col-lg-6 loginField">
<div class="margin-left-10">
test
</div>
</div>
If you have changed the breakpoints, you'll need to update that min-width, but this is the default min-width for Bootstrap's large columns.
When the screen gets smaller, the rule stops being applied, so it won't affect your smaller screens.

Bootstrap: working with LESS, what's the good way?

I have a couple of questions I hope you help me to clarify about working with semantic markup, using less with bootstrap 3 mixins.
First, columns setup:
On a non-semantic html you'd declare the cols on the div class <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12"></div> as example.
As stated on bootstrap documentation you should declare the amount of columns for a given div with the .make-xx-column(#columnms), but, if you want to replicate the non-semantic it's supposed that code would be:
.make-lg-column(4); .make-md-column(6); .make-sm-column(12); .make-xs-column(12);
With this I found that when you are on a big resolution (more than 1200px) and if I have defined .make-lg-column(4); and .make-md-column(6); the result will be the 6 medium columns will be showed. On my inspector it shows as #media (min-width: 992px) and will rule over the #media (min-width: 1200px)
What is then, the correct way to set the different column values for a div? It seems to not be equal to how you'd set them up on a non-semantic layout.
Finally a question about padding,
Why when on the regular bootstrap css the column has a defined padding (15px as default) on the mixins the default padding is 0px? That forces to set the padding each time you declare a column amount (.make-lg-column(12, 30px);) ?
I appreciate if someone can help me working with this the right way, I'm sorry but It's the first time I work with LESS and semantic html code with bootstrap.
I'm sure that this question has an answer on SO already, but for the time being.
You should call the mixins for the smallest grid (xs) first, or better call the mixins from small to width. (kind of mobile first)
The above make sense because of the media queries for the grid are defined with min-width, see also http://getbootstrap.com/css/#grid.
If you set the largest grid first (min-width:1200px) follow by (min-width:992px) then both will evaluate true for screensize wider than 1199 pixels, and so the latest override the first.
You should use:
.make-xs-column(12);
.make-sm-column(12);
.make-md-column(6);
.make-lg-column(4);
Why when on the regular bootstrap css the column has a defined padding
(15px as default) on the mixins the default padding is 0px? That
forces to set the padding each time you declare a column amount
(.make-lg-column(12, 30px);) ?
The default grids have a gutter of 30 pixels (set by #grid-gutter-width) between the columns. 15 pixels on each side of the columns, makes 2 x 15 pixels between each column.
Why when on the regular bootstrap css the column has a defined padding (15px as default) on >the mixins the default padding is 0px? That forces to set the padding each time you declare >a column amount (.make-lg-column(12, 30px);) ?
I found that:
#import "variables";
#import "mixins";
selector {
.make-lg-column(12, 30px);
}
compiles into CSS code as follows:
selector {
position: relative;
min-height: 1px;
padding-left: 15px;
padding-right: 15px;
}
#media (min-width: 1200px) {
selector {
float: left;
width: 100%;
}
}
Bootstrap uses predefined sizing to maintain responsiveness behavior regardless of the screen size. I know you are thinking "1200px is 1200px regardless the screen. But remember we are talking about percentages. So, if you were going to display a gallery with a tiles side to side in a laptop, you'll be fine with:
<div class="col-md-3">picture 1</div>
<div class="col-md-3">picture 2</div>
<div class="col-md-3">picture 3</div>
<div class="col-md-3">picture 4</div>
They will fit just fine and keep a great display. But will that be the case if the split the width of the screen 4 ways in a smartphone? Probably too small, right? In that case, you'll be better off with:
<div class="col-xs-12">picture 1</div>
<div class="col-xs-12">picture 2</div>
<div class="col-xs-12">picture 3</div>
<div class="col-xs-12">picture 4</div>
This way they display accross the entire screen
In summary, ideally, you'd want to do the following:
<div class="col-md-3 col-xs-12">picture 1</div>
<div class="col-md-3 col-xs-12">picture 2</div>
<div class="col-md-3 col-xs-12">picture 3</div>
<div class="col-md-3 col-xs-12">picture 4</div>
Hope that helped

Mixing natural width and Bootstrap width columns

So I've got a Bootstrap 3 form where I simply want to line up a bunch of spans in a neat row, degrading into a stack on mobile:
From [station1] to [station2] at [time]
From
[station1]
to
[station2]
at
[time]
Obviously I can do this, and it works:
<div class="row">
<div class="col-md-1">From</div>
<div class="col-md-3"><select>...</select></div>
<div class="col-md-1">To</div>
<div class="col-md-3"><select>...</select></div>
...
</div>
However, it looks rather silly if the screen is wide:
From [station1] to [station2] at [time]
If I queue up some spans without the col-X-Y classes, they don't play nice with Bootstrap. And if I try to mix together grid and non-grid spans or divs, they get ordered in weird and mysterious ways as shown in the last two rows of this JSFiddle. Help?
Bootstrap is not the solution to everything. You still have to write your own CSS at times. You can reduce your column widths for larger screens by using the appropriate classes, but that will not improve things much.
Instead, you are better off writing your own CSS. Style your elements to be inline-block, add some margin and padding. If you want to take it a step further you can write your own media queries to handle styles at reduced widths.
Look at line 260 in the variables file in Bootstrap.
#screen-xs: 480px;
#screen-xs-min: #screen-xs;
#screen-phone: #screen-xs-min;
You can use those variables to create viewport specific CSS.
#media (max-width: $screen-xs) {
// Change spans to block
span.my-field {
display: block;
margin-bottom: 10px;
}
}
If you are not using Sass or Less, you can hardcode the values of the variables. For example, 480px instead of $screen-xs.
You could wrap the columns in a smaller width col, such as col-sm-5 or col-sm-6..
<div class="row">
<div class="col-sm-4">
<div class="col-lg-2">From</div>
<div class="col-lg-2"><select><option>station</option></select></div>
<div class="col-lg-2">To</div>
<div class="col-lg-2"><select><option>station</option></select></div>
<div class="col-lg-2">at</div>
<div class="col-lg-2"><select><option>time</option></select></div>
</div>
</div>
Demo: http://www.bootply.com/116599
An alternate approach:
<span>From</span>
<br class="visible-xs visible-sm"/>
<span>...</span>
<br class="visible-xs visible-sm"/>
Looks nasty, but seems to work nice. I haven't found any issues yet.

Resources