Solved

Lines Not Lining Up

Posted on 2016-09-24
2
51 Views
Last Modified: 2016-09-25
I have a page where the lines across the top do not line up. When I take out the doctype declaration and <html> tag it lines up. Can someone point me in the right direction?

http://domgarofalo.com/logan/
0
Comment
Question by:dgarofalo
2 Comments
 
LVL 21

Accepted Solution

by:
Kim Walker earned 500 total points
ID: 41814273
The issue is that img elements are inline elements just as text content is inline. The default value for the vertical-align property of all img elements is baseline. This means that the img sits above the baseline of the text around it. Whether there is text before or after the image or not, there is descender space below the baseline.

There are two methods of eliminating the descender space below the image. One is to change the vertical-align property to a value of top or bottom. This would cause the image to be aligned to either the top of the text ascenders or the bottom of the text descenders; effectively moving the text baseline up and eliminating the extra space.
img { vertical-align: bottom; }

Open in new window

The second method is to change the image display property to block. Of course, this would only work if the image was placed independently, without any text before or after it.
#header a img { display: block; }

Open in new window

It is interesting that removing the doctype makes a difference. I suppose the default vertical-align property for img elements is different in different versions of HTML.

Allow me to commend you for writing HTML compliant code. The HTML validator returned no errors when evaluating your page.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 41814337
The background image has a fixed position for the lines but your header doesn't have a fixed height to match the position of the lines.  It also looks like the default margins and padding of the header elements is pushing the navigation section down.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The viewer will learn how to dynamically set the form action using jQuery.
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

15 Experts available now in Live!

Get 1:1 Help Now