Responsive issue : image (float left) and div -> image (center) and div under - css

I've a small issue. I've an image with float: left; and then a div with text. The result is something like that : https://css-tricks.com/wp-content/csstricks-uploads/web-text-wrap.png
Which is great. But when the screen got smaller, at the end, because the image is only 250px large, there's the image on the left and few words on the right. I would like to "push" the div with test under the image and center the image at the same time : when the screen is, for example 400px large.
How can I do this !? It seems quite easy, but all the tutos or codepen I tried just confused me...
Thanks

Research media tags I think they are exactly what you are looking for.
So your css would go something like this:
#media all (width: 400px){
.image{
...
margin: 0 auto;
}
}

Thanks Constantly Confused and smoggers.
I used smoggers' code, didn't worked as expected, but was a perfect base to try and find solution :
.images {float: left;}
#media screen and (max-width: 400px) {
.images {
float: none;
width: auto;
display: table;
margin: 0 auto;
padding-bottom: 5%;
}
}
Thanks again.

Related

Liquid layout explanation

Please see this example. When we resize the viewport, the font-size inside .main class grows, but inside .aside doesn't change anything. Could anyone please explain this for me? Thanks in advance!
Move .aside from media query:
#media (min-width: 700px){
.aside {
float: left;
width: 25%;
margin-left: 5%;
}
}
and put them like this:
.aside {
float: left;
width: 25%;
margin-left: 5%;
}
#media (min-width: 700px){
}
I think its because you haven't defined them anywhere else than in media query. Can you make JSFiddle out of this?
root cause:
Font size applyed based on container width (.main & .aside).
Fix:
You can fix this issue by using vw viewport width.
Viewport:
The % is relative to local width container, The vw length is relative to the full width of the browser window.
Default resolution:
body{
font-size:1vw;
}
Low resolution:
body{
font-size:4vw;
}

Positioning image banner on a wordpress site

I am a newbie experimenting with Wordpress. Would like to know the answer for the following question:
In the following website : http://thejuicesensei.com/wp/
I have a picture in my header. On a full screen it looks ok but on mobile and when minimized the picture is on the left of the page. I would like it to be on the right. I thought that maybe I had to use CSS to reposition it so i did the following:
.widget-header img { float: left; } to .widget-header img { float: right; }
in hopes that it would work. However nothing seems to have changed. Did i select the wrong class or something? Any help would be appreciated and sorry if it sounds like such a basic question.
(currently using the splash theme for wordpress)
Right now it looks like this:
I want the image to be on the right so there isnt that ugly gap of white.
Regards
Style parent of img from float:left to float:right
#media screen and (max-width: 728px){
.widget-header {
max-width: 100%;
float: right; //change this
margin-top: 0;
}
}
Please add float:right to below class.
#media screen and (max-width: 728px){
.widget-header {
float: right;
}
}

Responsiveness and side margins on big screens

I am having trouble developing a website using Bootstrap. I am currently trying to have a margin on the side, when the screen or viewport is too big. But when I finally got it, it broke the responsiveness of the page.
The whole body is inside this div to create the margins:
div style="width:1300px; margin:auto;"
Add this media query to your CSS and make sure it's referenced after any other CSS:
#media screen and (min-width: 1300px) {
body {
max-width: 1300px;
margin-left: auto;
margin-right: auto;
}
}

bootstrap 3 - Inverse nav-justifed

How to make nav-justified to act in reverse order? What I mean is, I want on small (mobile) screens from tabs/pills to be positioned horizontally, and on bigger (desktop) screens to be positioned vertically i.e. to be stacked.
Here's an example for which CSS rules need to be modified (resize its window to see how it would look on both type of screens): http://s.bootply.com/render/1d0Cpp0po1
Does anyone know how to achieve this on the simplest way? Thanks in advance!
Solved it with this CSS:
.nav-justified-inverse > li {
float: none;
}
#media (max-width: 768px) {
.nav-justified-inverse > li {
display: table-cell;
width: 1%;
}
}
Demo: http://s.bootply.com/render/AtQH4rry48

Centering a span tag in Wordpress?

I've set up a media query that should center an image when the screen is smaller than 600px. When bigger then 600px, the image correctly displays to the right of the site title. Chrome inspector assures me that the queries are working, but I think there might be an overarching rule that's keeping my margin: auto from applying. The 'globes' image in question is at the top of:
http://livinginbetween.org/temp/
I'd love any suggestions. Thanks in advance for your time.
Add display: block; to your media query to center the image.
#media only screen and (max-width: 599px) and (min-width: 0px) {
.globes {
display: block;
width: 159px;
margin: 0 auto 0 auto;
}
}

Resources