I am trying to make some divs responsive.It's a joomla module actually. But it isn't responsive. My template is responsive. I put that module in a position but if resize the screen it gets bigger and it goes outside that position.
I started with the first div (YJYC container) and I set the width to 100%. This is a good start, becouse I noticed that if I resize the screen, the result is "good". But I have to do this at the other divs, right?.
How should I continue?
Here is the html
<div id="YJYSC_container<?php echo $container_poz ?>" style="height:<?php echo $slider_height ?>px; width:<?php echo $slider_width ?>px;">
<!-- navigator -->
<div id="navigator_outer" style="height:<?php echo $slider_height ?>px; width:<?php echo $thumb_width +30 ?>px;">
<ul id="navigator">
<?php foreach ($yousclides as $youscslide):?>
<li class="element" style="height:<?php echo $slider_height / $visibleItems ?>px">
<div class="inner" style="width:<?php echo $thumb_width + 30 ?>px;height:<?php echo $slider_height / $visibleItems ?>px">
<div class="inner_over" style="width:<?php echo $thumb_width +30 ?>px;height:<?php echo $slider_height / $visibleItems -12 ?>px">
<div class="border_out" style="height:<?php echo $slider_height / $visibleItems -20 ?>px;width:<?php echo $thumb_width + 0 ?>px;">
<div class="border_in" style="height:<?php echo $slider_height / $visibleItems -20 ?>px;width:<?php echo $thumb_width + 0 ?>px;">
<?php if($youscslide['img_url'] != "") echo $youscslide['img_tumb']; ?>
</div>
</div>
</div>
</div>
</li>
<?php endforeach;?>
</ul>
</div>
<!-- end of navigator, start slides -->
<div id="slides" style="height:<?php echo $slider_height ?>px; width:<?php echo $slider_width ?>px;">
<?php foreach ($yousclides as $youscslide):?>
<div class="slide" style="height:<?php echo $slider_height ?>px; width:<?php echo $slider_width ?>px;"> <a href="<?php echo $youscslide['link'] ?>" title="">
<?php if($youscslide['img_url'] != "") echo $youscslide['img_out'] ?>
</a>
<div class="long_desc" style="width:<?php echo $intro_desc_width ?>;height:<?php echo $intro_desc_height ?>;<?php echo $intro_desc_pozi ?>">
<h1><?php echo $youscslide['title'] ?></h1>
<?php echo $youscslide['intro'] ?> <?php echo JText::_('YOUSC_READ') ?> </div>
</div>
<?php endforeach;?>
</div>
</div>
Use this:
#media screen and (max-width: 900px) {
#YJYSC_container, #YJYSC_container_l {
width: 100% !important;
height: auto !important;
}
#YJYSC_container_l #navigator_outer {
position: relative !important;
width: 100% !important;
height: auto !important;
margin-bottom: 20px;
}
#YJYSC_container #slides, #YJYSC_container_l #slides {
width: 100% !important;
}
#YJYSC_container #slides div.slide, #YJYSC_container_l #slides div.slide {
width: 100% !important;
}
#YJYSC_container #navigator li.element div.inner, #YJYSC_container_l #navigator li.element div.inner,
#YJYSC_container #navigator li.element div.inner_over, #YJYSC_container_l #navigator li.element div.inner_over,
#YJYSC_container_l #navigator li.element div.inner div.inner_over .border_out,
#YJYSC_container #navigator li.element div.inner div.inner_over .border_in, #YJYSC_container_l #navigator li.element div.inner div.inner_over .border_in,
#YJYSC_container #navigator li.element div.inner div.inner_over .border_in, #YJYSC_container_l #navigator li.element div.inner div.inner_over .border_in img{
width: 100% !important;
height: auto !important;
float: none !important;
}
#YJYSC_container #navigator li.element, #YJYSC_container_l #navigator li.element {
float: left;
width: 33% !important;
height: auto !important;
clear: none !important;
}
#YJYSC_container #navigator, #YJYSC_container_l #navigator {
overflow: auto !important;
}
}
This code triggers on devices with width under 900px. It still needs more work, but responsivity is starting to make sense.
Updated jsfiddle:
http://jsfiddle.net/gg9mvtrt/1/
Related
Earlier I asked question about my profile design, I am said I was not gone use the same design on mobile phone but I've changed my mind, howere i use height:10%; on the banner in the main style but when using #media all and (max-width:1024;){} and having same class but with height:30%; it wont change. I have a different css where I do the same thing but there it works (most of the times).
html:
<?php if($user_visible == 'a'){ ?>
<!--Profile picture, banner, and main information-->
<div class="profile-wrapper">
<?php if(isset($user_avatar)){ echo'<img class="banner" src="/assets/images/banner/'.$user_banner.'" />'; }else{ echo'<img class="banner" src="/assets/images/banner/default.png" />'; }?>
<!--profile picture-->
<?php if(isset($user_avatar)){ echo'<img class="avatar" src="/assets/images/users/'.$user_avatar.'" />'; }else{ echo'<img class="avatar" src="/assets/images/users/default.png" />'; }?>
<!--user information-->
<div class="user-information">
<p><?php echo $user_name; ?><br />
<?php echo $user_firstname; ?> <?php echo $user_lastname; ?></p>
</div>
</div>
css:
/* **************************************************************************************
///////////////////////Main Style////////////////////////////////////////////////////////
************************************************************************************** */
#media all and (min-width:1024px;) {
.avatar {
border: 2px solid #fff;
border-radius:5px;
margin-top:-10%;
margin-left: 5%;
width:15%;
height:auto;
}
.banner {
border: 2px solid #fff;
border-radius:5px;
margin-top: 20px;
height:10%;
width:100%;
}
.profile-wrapper {
margin:0 auto;
width:90%;
}
}
/* **************************************************************************************
///////////////////////Tablet////////////////////////////////////////////////////////////
************************************************************************************** */
#media all and (max-width: 1024px) {
.banner { height:30%; }
}
/* **************************************************************************************
///////////////////////Phone/////////////////////////////////////////////////////////////
************************************************************************************** */
#media all and (max-width: 768px) {
.banner { height:30%; }
}
These are the most universal media queries out there as they will help you to cover most of the different screen sizes decently:
#media(max-width:767px){}
#media(min-width:768px){}
#media(min-width:992px){}
#media(min-width:1200px){}
So try these media queries for your banner:
#media(min-width:992px){
.banner {
height: 30%;
}
}
#media(min-width:1200px){
.banner {
height: 10%;
}
}
i'm developing this website : www.sfitnesscenter.com
i'm trying to make the 4 boxes below the slider to be horizontally aligned 2 by 2 to the center. i've tried using margin:auto, but nothing changed.
here's the html
<section id="wrapsecond">
<div class="container">
<div class="services-wrap">
<?php if( get_theme_mod('shortinfo_sb') ) { ?>
<?php echo get_theme_mod('shortinfo_sb'); ?>
<?php } else { ?>
<?php echo '<h2>What We Do</h2>
<p>We are passionate about our clients results.</p>'; } ?>
<div class="space50"></div>
<!-- Home Boxes Section -->
<div class="home_boxes">
<?php
for($bx=1; $bx<5; $bx++) {
if( get_theme_mod('page-setting'.$bx)) {
$bxquery = new WP_query('page_id='.get_theme_mod('page-setting'.$bx,true));
while( $bxquery->have_posts() ) : $bxquery->the_post();
?>
<div class="one_third <?php if($bx%4==0){ ?>last_column<?php } ?>">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?>
<h4><?php the_title(); ?></h4><?php echo fitnesslite_content(22); ?>
<span class="ReadMore"><?php _e('Read More','fitness-lite');?> </span>
</a>
</div>
<?php endwhile; }else{?>
<div class="one_third <?php if($bx%4==0){ ?>last_column<?php } ?>">
<a href="#"><img src="<?php echo get_template_directory_uri(); ?>/images/thumb_0<?php echo $bx; ?>.jpg"><h4><?php _e('Page Title','fitness-lite'); ?><?php echo $bx; ?></h4><p><?php _e('Phasellus viverra aliquet magna quis interduming. Sed quis fringilla massa. In ut porttitor felis necing iaculis mi. Proin tempo...','fitness-lite');?></p><span class="ReadMore"><?php _e('Read More','fitness-lite');?></span>
</a></div>
<?php }}?>
</div>
<!-- Home Boxes Section -->
</div><!-- services-wrap-->
<div class="clear"></div>
</div><!-- container -->
</section><div class="clear"></div>
and here's the css
/* = Services section css
-------------------------------------------------------------- */
#wrapsecond{ background-color:#272727; color:#fff; padding-bottom:100px; }
.services-wrap, #FrontBlogPost .BlogPosts{ visibility:hidden;}
.one_third{ margin:0 5% 3.5% 0; float:left; padding:25px; border:2px solid #fff;}
.one_third:hover{ border-color:#ff4e1c;}
.one_third:hover .ReadMore{ background-color:#ff4e1c;}
.one_third img{ width:100%;}
.one_third h4{font:600 18px/22px 'Roboto',sans-serif; padding:20px 0; margin:0; text-transform:uppercase; color:#fff;}
.one_third h4 span{ color:#ff4e1c; font-weight:300;}
.one_third h4 span::after{content:" ________"; display:inline-block;}
.one_third p{ margin-bottom:20px; color:#fff;}
.last_column{clear:right; margin-right:0 !important; }
#media (max-width: 992px) {
.one_third { min-width: 45% }
}
#media (min-width: 992px) {
.one_third { max-width: 40% }
}
#wrapsecond h2{ font-size:40px; color:#fff; font-weight:600; margin-bottom:0; text-transform:uppercase; }
#wrapsecond h2 span{ color:#ff4e1c; font-weight:300; }
NB :
actually, the layout should be like this
top left : aerobic class,
top right : bellydance class,
bottom left : yoga class,
bottom right : zumba class
it was horizontally and vertically paralled, until my client put the contents the other day. nothing's change even after the photos was removed. so, i don't think it was caused by the dimension of those photos
Change the display of the boxes to inline-block and reduce the margin a bit. And remove the float .
Change the .one_third class to the following
.one_third {
margin: 0 3% 3.5% 0;
padding: 25px;
display: inline-block;
border: 2px solid #fff;
}
Avoid using floats . its a messy thing to deal with.
Dear Stackoverflow community,
I just can't figure out how to center the footer links on my magento website. The footer links are within a div and the correspondig CSS is, as I believe, as follows:
I have tried everything, from margin:auto to margin-right and margin-left auto.
Then I thought, maybe the right footer, there used to be a newsletter box there, is forcing to take up space, so I slashed it out, but still no effect. Anyone any idea what could be the solution? Thank you so much!
.footer-container { width:100%; text-align: left;}
.footer { margin: 0 auto 0;width: 940px; padding: 0 20px 30px; background: #fff; }
.aditional-footer { margin:0 auto 0; padding: 30px 20px 35px; width: 940px; background: #FFF;}
.footer .links li { text-transform: none;}
.footer-container a { color:#666669; font-size: 9px; }
/*.footer-container .footer-right { width: 250px; }*/
.footer .f-left { width:520px; text-align: left; margin: 0 auto;}
/*.footer .f-right { width:420px; text-align: right; }*/
This is the HTML
<html>
<div class="footer-container">
<div class="aditional-footer">
<?php echo $this->getChildHtml('bottomContainer') ?>
<div class="f-right">
<div class="footer-right">
<div class="right-conteiner">
<?php echo $this->getChildHtml('newsletter') ?>
<div class="clear"></div>
</div>
<div class="right-conteiner">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_time')->toHtml(); ?>
<?php if(themeOptions('topbtn')): ?>
<div id="back-to-top"><?php echo $this->__('Back to top') ?></div>
<?php endif; ?>
<div style="clear: both;"></div>
</div>
</div>
</div>
<div class="f-left footer-left">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_shipping')->toHtml(); ?>
</div>
<div style="clear: both;"></div>
</div>
</div>
<div class="footer">
<?php echo $this->getChildHtml('bottomContainer') ?>
<div class="f-left">
<?php echo $this->getChildHtml('footer_links') ?><br />
<?php echo $this->getCopyright() ?>
<?php echo $this->getChildHtml('cms_footer_links') ?>
</div>
<div class="f-right">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('verify')->toHtml(); ?>
</div>
</div>
</html>
Change the following code
.footer-container { width:100%; text-align: left;}
to
.footer-container { width:100%; text-align: center;}
Let me know if you have any query
I'm having a problem with this: http://jsfiddle.net/1904837j/
As you can see, when I hover over an image, the text that goes visible is the one under the next image.
What I want is have the text show up under the image being hovered over.
Here is the code:
HTML:
<div class="header">
<div class="cats">
<div class="adminmenu"><img src="<?php echo $host ?>/img/admin/ipban.png"><div class="undername">Test</div></div>
<div class="adminmenu"><img src="<?php echo $host ?>/img/admin/ban.png"><div class="undername">Test</div></div>
<div class="adminmenu"><img src="<?php echo $host ?>/img/admin/smiley.png"><div class="undername">Test</div></div>
<div class="adminmenu"><img src="<?php echo $host ?>/img/admin/gear.png"><div class="undername">Test</div></div>
<div class="adminmenu"><img src="<?php echo $host ?>/img/admin/forums.png"><div class="undername">Test</div></div>
<div class="adminmenu"><img src="<?php echo $host ?>/img/admin/quit.png"><div class="undername">Test</div></div>
</div>
</div>
CSS:
.header .cats{
margin-top:15px;
text-align:center;
}
.header img{
margin-left:10px;
margin-right:10px;
}
.adminmenu{
display:inline-block;
}
.adminmenu:hover + .adminmenu .undername{
opacity: 1;
filter: alpha(opacity=100);
}
.adminmenu .undername{
font-size: 10px;
color:white;
opacity: 0;
filter: alpha(opacity=0);
}
You're targeting .adminmenu child, so use:
.adminmenu:hover .undername{
opacity: 1;
filter: alpha(opacity=100);
}
JSFiddle
Explanation: with .adminmenu:hover + .adminmenu .undername you are targeting the next in level .adminmenu elements child element that has .undername class, and that's why in your fiddle it works for the next element.
I have this page here and the div .menu-content only reaches half the page even on 100% height. I really have no idea why.
Thanks!
<div class = "menu-content">
<div class="wrapper" style = "background-color:white; height:100%; width:750px;">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php else : ?>
<?php global $rd_data; if ($rd_data['rd_error_text']) { ?>
<?php echo $rd_data['rd_error_text']; ?>
<?php } else { ?>
Oops, It looks like an error has occured
<?php } ?>
<?php endif; ?>
</div>
You need to remove height:100%; on .menu-content .wrapper in your CSS code and in the inline style you set on it.
That way it will be set to default height:auto; and the height will be calculated by it's content.
Try this css..
.menu-content {
display: table;
margin-bottom: 0;
margin-left: auto;
margin-right: auto;
margin-top: 0;
position: relative;
}
Add html {height: 100%} and it should work.
to solve this you can simply add a div with style = "clear:both;" at the end of your div .menu-content
like this :
<div class="menu-content">
.....................
<div style="clear:both;"></div>
</div>
you have to use css this way. use the overflow:auto property and remove the unnecessary property like z-index and position from class .wrapper.
.menu-content {
background-color: #FFFFFF;
height: 100%;
overflow: auto;
}
.wrapper {
margin: 0 auto;
width: 750px;
}