November 19, 201412 yr Hi, need some help with aligning div left and another div right on the same level. Everything looks ok on my laptop but when I view it on a 22” screen there’s a big cap between the two div’s Code below left { position: absolute; top: 153px; left: 95px; width: 300px; height:58px; /*background-color: #E8EAEB;*/ } .right { position: absolute; top: 170px; right: 995px; width: 30px; height: 48px; background-color: #; }
November 19, 201412 yr A blind guess. left { Float:left; Margin-top: 153px; Margin-left: 95px; width: 300px; height:58px; /*background-color: #E8EAEB;*/ } .right { Float:right; Margin-top: 170px; width: 30px; height: 48px; background-color: #;
November 20, 201412 yr Best thing to do when you have a coding issue like this is to fire up jsFiddle and put it in there, then we can see a live version. With just looking at your code though, the use of all those 'magic numbers' is a bit alarming, but it's hard to reason because we cannot see a live version. Going with floats like Fuzzy posted sounds about right, but again, hard to tell with no live version. One thing to note is that if you are floating things like this you will need to add in a clearfix to the floated elements container to prevent it from collapsing.
November 20, 201412 yr Best thing to do when you have a coding issue like this is to fire up jsFiddle and put it in there, then we can see a live version. With just looking at your code though, the use of all those 'magic numbers' is a bit alarming, but it's hard to reason because we cannot see a live version. Going with floats like Fuzzy posted sounds about right, but again, hard to tell with no live version. One thing to note is that if you are floating things like this you will need to add in a clearfix to the floated elements container to prevent it from collapsing. Yeah those magic numbers are a touch confusing, they don't add up. I can see the first problem with the OP code is absolute positioning without a relative wrapper of some sort, that's where I guess the spacing is coming from but those numbers (top and height) don't add up to the same total height, very confusing. Here's a jsfiddle at what i'm guessing the op was trying to do? Edited November 20, 201412 yr by BrowserBugs
Create an account or sign in to comment