- This topic is empty.
-
AuthorPosts
-
May 6, 2012 at 3:10 pm #37954dannygreenMember
Basically I have a header with a logo floated left with a h1 and h2 to its right hand side, it is a responsive layout therefore the margin-left for both the h1/h2 are set as %. However, as you can see here http://airporthopperuk.com/danny/ the h2 is too far to the right, even though they both have the same margin-left value, also when you drag the browser window inwards, the h2 seems to be ‘racing’ the h1 to the logo rather than moving in together. Could this be caused by me having the h2 set as text-align:centre ?
this is my css:
header {
height:12.1875em;
width:100%;
background-color:#cd3c1e;
}
#logo {
margin-left:18.887755%;
margin-top:2.1875em;
float:left;
}
h1.title {
font-family:'Signika', sans-serif;
font-weight:200;
color:#fff;
font-size:2.896875em;
margin-left:53.06122%;
padding-top:45px;
}
h2.subtitle {
font-family:'Signika', sans-serif;
font-weight:200;
color:#fff;
font-size:0.96em;
margin-left:53.06122%;
margin-top:15px;
text-align:center;
}Thanks
DannyMay 6, 2012 at 3:33 pm #102413AnonymousInactiveThe h2 being set to text-align: center is exactly the issue. Set the background to #369 (or similar) to see what is going on. Either setting the h1 to the same text alignment, or setting the width of the h2 to match the width of the h1 should fix it (300px).
May 6, 2012 at 5:34 pm #102417dannygreenMemberThanks for your help,
Is there a better way i could do this? I would like to avoid using pixel based width values if possible and would like to have a ‘real’ margin-left value rather than one I’ve made up to bodge this issue.Thanks
May 7, 2012 at 7:17 am #102433AnonymousInactiveWhy not make your header the same width as your content is going to be and position your h1/h2 to the right? If you want your h2 text to be centrally aligned under your non-centered h1 text, then I’m pretty sure you will need to dictate the width. Sorry.
May 8, 2012 at 4:35 pm #102535dannygreenMemberSorted it thanks, by using a wrapper with width:100% and max-width:980px. Thanks
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.