Community Forums › Forums › Archived Forums › Design Tips and Tricks › change of image alignment on smaller displays
Tagged: css, image alignment, problem
- This topic has 8 replies, 2 voices, and was last updated 10 years, 5 months ago by
kridgroup.
-
AuthorPosts
-
October 17, 2014 at 3:45 pm #128192
kridgroup
MemberOn this specific page - using the Executive Pro theme - I have two images, which on larger displays are aligned right:
https://www.kridconsulting.com/company/
Now, to improve readability on smaller screens, I have adjusted the text wrap using the following:
@media only screen and (max-width: 629px) {
.alignleft, .alignright {
clear: both;
float: none;
display: block;
}
}How can I in the same context change the image alignment to e.g. left?
Thanks in advance!
https://www.kridconsulting.com/company/October 17, 2014 at 5:51 pm #128208Sridhar Katakam
ParticipantYou can see that each image can be uniquely identified using one of its classes.
Ex.: The Team image "wp-image-516". So you can write CSS for "img.wp-image-516" and set its float to left if you want to float it left from a specific width onwards.
October 17, 2014 at 6:54 pm #128212kridgroup
MemberThanks!
But it seems I am not getting the syntax right.
My custom css now looks like this:
#genesis-Footer {
background-color: #ffffff;
}.page-id-321 .entry-title, .page-id-298 .entry-title, .page-id-605 .entry-title, .page-id-603 .entry-title, .page-id-633 .entry-title, .page-id-632 .entry-title, .page-id-630 .entry-title, .page-id-635 .entry-title, .page-id-634 .entry-title, .page-id-618 .entry-title, .page-id-621 .entry-title, .page-id-615 .entry-title, .page-id-612 .entry-title, .page-id-651 .entry-title, .page-id-891 .entry-title {
display: none;
}
@media only screen and (max-width: 629px) {
.alignleft, .alignright {
clear: both;
float: none;
display: block;
}
}
@media only screen and (max-width: 320px) {
.gallery-columns-3 .gallery-item {
width: 100%;
margin-bottom: 20px;
}
}I tried adding:
@media only screen and (max-width: 629px) {
img.wp-image-516 {
float: left;
}
}But that does not change anything…
Any advise?
Thanks
October 17, 2014 at 7:43 pm #128218Sridhar Katakam
ParticipantI do not find that CSS on the site when inspecting with Firebug. Have you added it in child theme's style.css or in a custom.css?
October 17, 2014 at 7:58 pm #128219kridgroup
MemberCheck style.css again now. i used the WordPress CSS editor before.
October 17, 2014 at 8:11 pm #128220Sridhar Katakam
ParticipantI searched for
img.wp-image-516
in https://www.kridconsulting.com/wp-content/themes/executive-pro/style.css and do not find it.
October 17, 2014 at 8:24 pm #128221kridgroup
MemberYou won't find it. I did not manage to get it work so i did not save it.
What I tried is what you see above: Adding the following at the end of style.css:
@media only screen and (max-width: 629px) {
img.wp-image-516 {
float: left;
}
}What I need to know is how to get the syntax right to get the image aligned left on small displays.
October 19, 2014 at 4:35 pm #128351Sridhar Katakam
ParticipantAdding
@media only screen and (max-width: 629px) { img.wp-image-516 { float: left; margin-left: 0; margin-right: 10px; } }
at the end in style.css in Firebug does float the image to the left with text moving to its right.
October 21, 2014 at 8:03 pm #128704kridgroup
MemberThanks a lot!
Dirk
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.