Solved

Responsive Styling

Posted on 2015-01-15
4
98 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

806 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