This is my first responsive site. I am happy with it however there is one very annoying aspect that has completely stumped me. The original site is www.elitemarquees.com.au I have changed the home page to:
http://elitemarquees.com.au/test/index.html
The issue is; when I make the browser smaller everything moves and behaves as I intended it except for the menu (#headNav) at one point. It jumps down into the main content (#content) and sits below the second line of body text. Then when you go smaller it rectifies its self and jumps back in between the logo (#headLogo) and the main body text. Here is how I have initially set up the div sections:
//this section contains two divs headLogo and headNav
#header {
height: 180px;
}
#headLogo {
width: 250px;
float: left;
}
#headNav {
width: 600px;
float: right;
margin-top: 70px;
padding-right: 40px
}
#content {
width: 500px;
float: right;
padding-right: 140px
}
The I do this which is where I believe the bad behaviour occurs:
/* for 700px or less */
#media screen and (max-width: 700px) {
#headNav {
width: auto;
float: none;
}
#headLogo {
width: auto;
float: none;
}
#content {
width: auto;
float: none;
}
#sidebar {
width: auto;
float: none;
}
}
It rectifies its self when this is fired:
/* for 480px or less */
#media screen and (max-width: 480px) {
#header {
height: auto;
}
#headNav {
padding-right: 0px;
margin-top: 0px;
}
h1 {
font-size: 24px;
}
#content {
padding-right: 10px
}
}
Thank you for any help
Here
/* for 700px or less */
#media screen and (max-width: 700px) {
#headNav {
width: auto;
float: none;
}
#headLogo {
width: auto;
float: none;
}
#content {
width: auto;
float: none;
}
#sidebar {
width: auto;
float: none;
}
}
You should add this :
#header{
height: auto;
}
Related
Im so new in CSS and trying to fix the following code..
I want a simple thing where the screen size is smaller than 400 change the image size..
it should work but it doesn't..
I tried to make
* {
box-sizing: border-box;
}
body, html {
background: #fff;
height: 100%;
margin: 10px;
}
.left__img2 {
position: absolute;
float: left;
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
border-radius: 20px;
width: 600px;
height: 400px;
}
#media screen and (max-width: 500px) {
.left__img2 {
width: 10px;
}
}
Media queries at the top of the CSS need !important to over rule the media query. Media queries at the bottom do not need !important. I placed the query at the top so I used !important to over rule any other style after.
#media screen and (max-width: 500px) {
.left__img2 {
width: 10px !important;
}
}
* {
box-sizing: border-box;
}
body, html {
background: #fff;
height: 100%;
margin: 10px;
}
.left__img2 {
position: absolute;
float: left;
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
border-radius: 20px;
width: 600px;
height: 400px;
}
I think this will work.
#media screen and (max-width: 500px) {
.left__img2 {
max-width: 10px;
}
}
Your code works well in the following example (resize your window), maybe it comes from a side effect of the rest of your code, can you show us the rest of your code?
.left__img2 {
position: absolute;
float: left;
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
border-radius: 20px;
width: 600px;
height: 400px;
background-color: red;
}
#media screen and (max-width: 500px) {
.left__img2 {
width: 10px;
background-color: yellow;
}
<div class="left__img2"><div>
I created this website and i have a problem with the mobile site. Which it does not fit to the content. How do i need to fix this? i have attached the css of the responsive below.
I have tried several codes. But it does not fit to the content. The website is smaller than the device. And making the width 100% did not work.
Thanks in Advance
#media only screen and (max-width: 600px) {
.content-area {
float: center;
width: 100%;
}
.social-navigation li a::before,
.sidebar-toggle {
font-size: 16px;
}
.sidebar-toggle {
height: 46px;
}
.site-title {
font-size: 32px !important;
}
}
#media only screen and (max-width: 500px) {
.content-area {
padding: 0;
width: 100%;
}
.container {
width: 100%;
}
.site-logo {
width: 50px;
text-align: left;
}
.site-title,
.entry-title {
padding-top:20px;
font-size: 18px !important;
}
.site-description {
margin-top: 0;
font-size: 16px !important;
}
}
please take a look at my sample code
HTML
<div class="custom-container">
<section class="parallax-bg-1 text-center" style="background-image:url('https://killtheboredomdotcom.files.wordpress.com/2015/08/skyline-of-rome.jpg?w=1920&h=768&crop=1')">
<h1 class="">Welcome</h1>
<p class="lead">subtitle</p>
</section>
</div>
CSS
.custom-container{
padding-right: 0;
padding-left: 0;
width: 100%,
}
section {
height:350px;
padding-top:50px;
padding-bottom:50px;
}
.parallax-bg-1 {
background: no-repeat top center fixed;
color:#fff;
background-size:cover;
}
containers
}
.custom-container{
padding-right: 0;
padding-left: 0;
width: 100%,
}
.container {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
#media (min-width: 1600px) {
.container {
max-width: 1600px;
}
}
#media (min-width: 1900px) {
.container {
max-width: 1900px;
}
}
#media (min-width: 768px) {
.container {
width: 750px;
}
}
#media (min-width: 992px) {
.container {
width: 970px;
}
}
#media (min-width: 1200px) {
.container {
width: 1180px;
}
}
.container-fluid {
padding-right: 15px;
padding-left: 15px;
width: 100%;
margin-right: auto;
margin-left: auto;
}
JS Fiddle: https://jsfiddle.net/unpvuzaq/ (it works just fine in JS Fiddle but on my end it's not)
the picture is in parallax mode but take a look at my web screenshot it still has padding
image resolution 1920x1080
kindly help me.
add CSS outer div container,
.container.body-content{
width: 100%;
padding: 0;
margin: 0;
}
i think image may smaller than your screen size...you should give image as stretch...
add style to section class:
background-size: cover;
.custom-container{
padding-right: 0;
padding-left: 0;
width: 100%;
}
section {
height:350px;
padding-top:50px;
padding-bottom:50px;
}
.parallax-bg-1 {
background: no-repeat top center fixed;
color:#fff;
background-size:100%;
}
background-size: 100%; is working on 4K resolution display. (tested)
My site, like many others, utilizes bootstrap's carousel on the home page.
For some reason, despite the carousel-control appearing and everything else looking fine, the data slide functionality stops working on monitor sizes less than 480px (so, any mobile device).
Is there a snippet of code I need to add to the #media(max-width:480px) section in the CSS? As it stands I don't have any carousel/responsive related code under that size, but just the following:
#media (max-width: 979px) {
.carousel .item {
height: 500px;
}
.carousel img {
width: auto;
height: 500px;
}
}
#media (max-width: 767px) {
.carousel {
margin-left: -20px;
margin-right: -20px;
}
.carousel .container {}
.carousel .item {
height: 300px;
}
.carousel img {
height: 300px;
}
.carousel-caption {
width: 65%;
padding: 0 70px;
margin-top: 100px;
}
.carousel-caption h1 {
font-size: 30px;
}
.carousel-caption .lead, .carousel-caption .btn {
font-size: 18px;
}
}
An example can be seen here.
Add a z-index on you carousel-control:
.carousel-control {
height: 80px;
margin-top: 0;
font-size: 120px;
text-shadow: 0 1px 1px rgba(0,0,0,.4);
background-color: transparent;
border: 0;
position: absolute;
top: 40%;
left: 15px;
color: #fff;
z-index: 99999; /*Add This */
}
What this is doing it just making this control be in front of the slider that is more than the actual screen size.
I'd like to make my gallery http://wordpress.org/extend/plugins/photospace-responsive/ be responsive with a vertical layout changing into a horizontal one when the browser is scaled down for mobile.
Please can you tell me how I can make it revert when the screen size is smaller to the gallery being on top?
See my test page
http://brightmist.co.uk/gallery/
I've even tried media queries
.photospace_res .gal_content {
float: left;
width: 80%;
}
.photospace_res .thumbs_wrap2 {
float: left;
min-height: 800px;
width: 20%;
}
#media all and (max-device-width: 480px) {
.photospace_res .gal_content {
float: none;
width: 100%;
}
.photospace_res .thumbs_wrap2 {
float: none;
min-height: 0;
width: 100%;
}
}
Thanks for your help
Judi
Yay I fixed it and added a few extra styles
.photospace_res .gal_content {
float: left;
width: 80%;
}
.photospace_res .thumbs_wrap2 {
float: left;
width: 20%;
}
.photospace_res {
margin: 0;
}
.photospace_res .ss-controls {
border: 1px solid #CCCCCC;
margin-bottom: 20px;
padding: 5px 10px;
}
#media screen and (max-width: 700px) {
.photospace_res .gal_content {
float: none;
width: 100%;
}
.photospace_res .thumbs_wrap2 {
float: none;
min-height: 0;
width: 100%;
}
}