Sidebar Wordpress With Bootstrap - wordpress

When in responsive website the sidebar moves to the footer of the page but the background-color won't fix the size of it, as the print screen.
http://i61.tinypic.com/v8hhkj.gif
What could I do here?
The website: http://bloganacastro.com

You have set width: 100% for the sidebar for proper display in responsive..
#media (max-width: 768px) {
.sidebar.col-md-4 {
width: 100%;
}
}

You have set width: 30% for the sidebar, which makes the background to shrink.
Let the browser calculate the width.
#media (max-width: 768px) {
.sidebar.col-md-4 {
width: auto;
}
}

Related

Apply css style only for mobile devices

I have a web app and I want for mobile only to remove the scroll bar from body element.
i have tried with
#media only screen and (max-width: 500px) {
body {
overflow-y: hidden;
}
}
but nothing happend, the css property is not applied;
How can I set the scroll hidden only on mobile?
Guess you will need to add more details because it's working as expected (resize your browser to see it or check this jsfiddle):
body {
height: 2000px;
}
#media only screen and (max-width: 500px) {
body {
background-color: red;
overflow-y: hidden;
}
}

Responsive Web Development-CSS -mobile slider height

I am trying to get my slider on my website to adjust to a different height in a mobile screen but didn't get it to work properly.
The website that i am trying to work on is www.msstoreway.com. After having added the css-code below, i could get the desktop/laptop screen to adjust but on a mobile screen the slider height wont change at all. Can you please advise what i am doing wrong and how to get the height to increase in a mobile screen only.Thanks. See my CSS-Codes that i have added.
regards
Mark
/* Smartphones (portrait) ----------- */
#media only screen
and (max-width : 320px) {
/* Styles */
#slider .rslides, #slider .rslides li { height: 250px; max-height:
250px; }
#slider .rslides img { height: 100%; max-height: 250px; }
}
The plugin you are using for the slider is scaling the height/width as inline styles which is overriding your css styles.
You are able to add the !important tag which will then override the inline styles, but do note you will lose the aspect ratio scaling that the js plugin is implementing.
#media only screen and (max-width : 500px) {
.rslides { height: 250px !important; }
.rslides img { height: 250px !important; }
}

Responsive Div's Width: 120px on 1200px Screen, 375px on 1920px Screen

I want a div to have a width of 120px on 1200px screen (10%) and when resizing the window to 1920px, the width will linearly increase to a width of 375px (around 20%). How can I achieve this without using JS?
I tried using the calc function but I can't think of the right formula to satisfy both.
I don't want to use Media Queries if possible, but if all else fails, what is the cleanest way to do it in Media Queries?
you can archive using #media-query
for example:
#media screen and (min-width: 1920px)
{
div{
width:375px;
}
}
this is how media query works
if you are looking for calc function try something like this , here 25em corresponds to 400px
{
min-width: 50%;
width: calc((25em - 100%) * 1000);
max-width: 100%;
/* Change 25em to your breakpoint. */
}
You could write it something like this:
div {
height: 200px;
width: 120px;
background-color: tomato;
}
#media (min-width: 1200px) {
div {
width: 120px;
}
}
#media (min-width: 1920px) {
div {
width: 375px;
}
}
This is just using a couple of media queries and a default width which is also necessary. I'm not sure why you wouldn't want to use media queries, they're supported in all current browser (and most old browsers too).
Following your comment, you could try doing something with Viewport units (Viewport width in this snippet). Here's an updated example without media queries:
div {
height: 200px;
width: 10vw;
min-width: 120px;
max-width: 375px;
background-color: tomato;
}

Bootstrap Responsive Navbar goes weird formatting at lower view ratios

Site: collecthw.com
When the NavBar is full screen it takes up 100% of the width of the screen and the search bar is in the NavBar.
On Mobile and when you shrink your browser window, it changes. I can't for the life of me figure out where I should be looking to make it not do this.
fletch pointed me to the right direction
#media (max-width: 767px) {
body {
padding-right: 20px;
padding-left: 20px;
}
needs changed to
#media (max-width: 767px) {
body {
padding-right: 0px;
padding-left: 0px;
}

css: Have a min-width that is possibly smaller than the max-width?

How would I produce the following...
I'd like my div to have a width of 400px. However, if less than 400px are available then I'd like it to have a width of 50%. Is this possible using just CSS? I've tried setting min-width and width but it seems to always go with whichever is larger.
Sounds like you want media queries:
#media screen and (min-width: 400px) {
div { width: 400px; }
}
#media screen and (max-width: 399px) {
div { width: 50%; }
}
why not use
width:auto;
height: auto;
in your css??
If your for the resolution you can use Media queries
#media screen and (max-width: 400px) {
//put css on body that you want to apply
body{
width:auto;
}
//put css on div that you want to apply
.div{
width:auto;
}
}
it means smaller than 400px will have this css or adjust to what it contains.

Resources