Solved

Responsive Styling

Posted on 2015-01-15
4
96 Views
Last Modified: 2015-01-15
I am updating code on a site that I inherited from another development team. There is one feature in the site that causes a background image to disappear once the screen size is reduced. I have gone through all the code and CSS and cannot figure out what they used to make this work. The section in question is #featured_area. Can anyone point me to the section of the code or the style in the CSS that is making this happen?

    <div id="featured_area" class="full_width">
    	<div class="page_wrapper">
		<div class="featured_title">
			<h1>Informed Patients Are Better Patients</h1><br>
			<p>Our Healthy Florida is designed to help patients navigate and understand the complex and confusing treatment options available today.</p>
		</div>
            <div class="featured_content">
            </div>
        </div>
    </div>

Open in new window


If you are following any of my other threads you will recognize this from the last problem I resolved. I have changed these pages but I need to solve this issue for yet another reason.
style.css
0
Comment
Question by:gacto
  • 3
4 Comments
 
LVL 38

Expert Comment

by:Tom Beck
ID: 40552309
I have an advantage on this one because I'm already familiar with your site.

The css that causes the background image to disappear at 539px width is in responsive.css, line 39 (according to the developer tools), not style.css.

@media only screen and (max-width: 539px) {
    #featured_area {
        background: none repeat scroll 0 0 #fff;
    }
}
0
 
LVL 38

Accepted Solution

by:
Tom Beck earned 500 total points
ID: 40552338
In style.css add background-size: contain to the #featured_area css like we discussed, leave everything else as is, then in responsive.css change the definition for #featured_area in the media query for 539px to:

#featured_area {
    background-position: center 200px;
}

This will move the background image down so it's not overlapping the text.

Then for other media query widths, add the same css as above but adjust the 200px value as needed to position the background image where it looks best for that width.

With a little tweaking, you can have the background image scale properly for every screen width. That's responsive design!
0
 

Author Comment

by:gacto
ID: 40552370
Yep you have an advantage and you solved it on the first shot. I didn't even consider the responsive.css sheet. I was too focused on style.css.

Thanks again for the help and the quick response. Hopefully I won't have too many more ridiculous questions come up.
0
 
LVL 38

Expert Comment

by:Tom Beck
ID: 40552732
Ridiculous?? Not even close.

Thanks for the points.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

939 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now