Seasonal Savings: 20% off selected memberships for a limited time. Give now

Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Visualizing content realignment for better markup

From: WordPress: Building Responsive Themes

Video: Visualizing content realignment for better markup

Once you have a clear idea of how your content will look on different screen sizes, you need to make sure your markup allows for this type of realignment. The one thing to keep in mind is that while the presentational aspects of your site may change as your responsive theme responds to different screen sizes and other scenarios, the markup, that is, the code behind the scenes, stays the same. That means your markup needs to accommodate all your different layouts simultaneously without becoming unnecessarily cluttered in the process.

Visualizing content realignment for better markup

Once you have a clear idea of how your content will look on different screen sizes, you need to make sure your markup allows for this type of realignment. The one thing to keep in mind is that while the presentational aspects of your site may change as your responsive theme responds to different screen sizes and other scenarios, the markup, that is, the code behind the scenes, stays the same. That means your markup needs to accommodate all your different layouts simultaneously without becoming unnecessarily cluttered in the process.

To make sure I know how I need to divide up my content, I like to draw lines in my designs so I can see what different sections I need to section off and how they relate to each other, and then I can match that between my full-size layout and my phone layout and see how these elements move in relation to each other. Let's, for example, take a look at the header. If I draw a box around the entire header, you'll see that we actually have three elements here. The reason why I know we have three elements is because if I look at the full-size version of the site versus the mobile-size version of the site I see the margins here are quite different.

So, what I mean to do is make sure I'm able to address those margin issues on both the site title and the menu. So, I am going to box the title and menu into a separate box, and then I am going to separate each one of them. I'll separate this one and I'll separate this one out. Now that I've done this on my wide layout, I can match these boxes on my narrow layout. So, I'll go in here and find the same area, and since I know that these boxes span around both the title and the menu, I have to span the box across the whole thing, and then I have to separate out the content.

So I'll separate out all the content first, and then I'll draw a box around the title and another box around my menu. So, based on this layout, I now know that I need to have a container and then another container within that container and then a container around my header and a container around my menu so that I can float them differently, because now I can see that the title needs to float to the left and the menu has to either float to the right on the full layout or float to the bottom on the phone layout.

Likewise, I can take a look at my main content. I know that all this content is contained within one box, but then I have to separate these further. The header content is handled separately from the main content, meaning that I have to treat this entire section as one unit and then this entire section as another unit. So, I'll do the same thing in my mobile layout again. I'll draw a box around all the content, and then I can separate out the individual pieces.

So, I have one section here for the header content and the meta element, and then I have another section here for the general body of the post. Looking at the two of them side by side, I now see that on the mobile side, everything is fine; I just have one set of content on top of the next. But in the wide layout, I now need to float the header content to the left and float the rest of the content to the right.

But this isn't as easy as it looks, because if I float it using the general float behavior, I'll end up with this content spanning in underneath. So I have to use some sort of trick to shift everything into place the way I want it to, and we'll address that later in the course. But that just proves the point I'm trying to make. Before you start writing your markup, you need to know which pieces of content relate to each other and how they relate to the other pieces on the page. That way you can put containers around pieces that belong together and these pieces then become easier to handle, because you can place them next to one another or on top of one another or hide one and show the other one depending on what you want to do in your layout.

By drawing out your main sections in your design and making it clear to yourself how they relate to one another, you'll be able to build markup that is ready to be responsive.

Show transcript

This video is part of

Image for WordPress: Building Responsive Themes
WordPress: Building Responsive Themes

39 video lessons · 18015 viewers

Morten Rand-Hendriksen
Author

 
Expand all | Collapse all
  1. 4m 5s
    1. Welcome
      1m 4s
    2. Using the exercise files
      1m 27s
    3. What you should know before watching this course
      1m 34s
  2. 8m 36s
    1. What is responsive design?
      4m 16s
    2. The different faces of WordPress on mobile
      1m 55s
    3. Exploring the finished Anaximander theme
      2m 25s
  3. 9m 38s
    1. Getting and installing the Anaximander theme
      1m 53s
    2. Configuring basic theme options
      7m 45s
  4. 23m 51s
    1. Deciding what screen sizes to design for
      4m 11s
    2. Thinking responsively: Designing for many different screen sizes
      6m 23s
    3. Visualizing content realignment for better markup
      4m 35s
    4. Designing menus
      4m 52s
    5. Adding responsive images and videos
      3m 50s
  5. 26m 8s
    1. What are media queries and how do they work?
      4m 18s
    2. Exploring CSS3, progressive enhancement, and graceful degradation
      3m 27s
    3. Understanding best practices for media queries
      3m 57s
    4. Creating a responsive frame
      5m 12s
    5. Customizing media queries with the Chrome Developer Tools
      5m 28s
    6. Taking device width into account
      3m 46s
  6. 11m 1s
    1. Resizing the site title and the description
      8m 22s
    2. Adding media queries to the header
      2m 39s
  7. 11m 22s
    1. Making the menu responsive
      3m 35s
    2. Creating a different menu design for small screens
      7m 47s
  8. 19m 22s
    1. Making a responsive single-post layout
      6m 11s
    2. Making images responsive
      4m 37s
    3. Making videos responsive by including FitVids
      8m 34s
  9. 7m 45s
    1. Making the sidebar responsive
      5m 10s
    2. Hiding sidebars on mobile
      2m 35s
  10. 7m 28s
    1. Dealing with footer widgets
      5m 11s
    2. Adding navigation links that return to the top of the page
      2m 17s
  11. 12m 54s
    1. Using FlexSlider to create a responsive slider
      6m 2s
    2. Creating a loop to show sticky posts in a featured slider
      6m 52s
  12. 24m 37s
    1. What is jQuery Masonry?
      3m 41s
    2. Installing jQuery Masonry
      4m 45s
    3. Configuring the index page with Masonry
      7m 0s
    4. Using CSS to finalize the Masonry layout
      6m 17s
    5. Adding media queries to the Masonry index
      2m 54s
  13. 9m 11s
    1. Exploring hidden features of the Anaximander theme
      5m 51s
    2. Where to go from here
      3m 20s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed WordPress: Building Responsive Themes.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.