Solved

Responsive Styling

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
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 tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
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…

746 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

12 Experts available now in Live!

Get 1:1 Help Now