Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Removing A Space

Posted on 2015-02-17
2
Medium Priority
?
67 Views
Last Modified: 2015-02-18
I have a space above "Social Media Woes" that I can't remove.
www.mediascrubber.com
I am attaching the file so that you can see.  It's in a div with a class off "hometext" here is the css.
.hometext  {
	margin-left: auto;
    margin-right: auto;
    width: 80%;
    }

Open in new window

Not sure why it won't line up to the top of the div.
index.php
0
Comment
Question by:DS928
2 Comments
 
LVL 12

Expert Comment

by:Nathan Riley
ID: 40614964
.hometext {
margin-left: auto;
margin-right: auto;
width: 80%;
margin-top: -40px;

Open in new window

0
 
LVL 44

Accepted Solution

by:
Chris Stanyon earned 2000 total points
ID: 40615468
It does line up with the top of the DIV already. The DIV above it (the one with the banner image) will expand to fit the entire image, which includes the 'star' on the right.

You do have a top margin on your H2 which pushes it down slightly. Remove that and it'll move the text up slightly:

h2 { margin-top: 0px; }

Negative margins, as Nathan suggested can work, but are often a sign of a 'hack' and can have some odd side-effects - you're basically moving your text DIV up so that it overlaps the image DIV. That may work on this page, but as soon as you don't have header text (or it fills the full width of the line), the text will sit on top of your image, and probably look wrong.

I would always recommend that if you find yourself needing to set negative margins - re-think your design!! There's often a better way to acheive what you want.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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 article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

886 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