June 20, 201115 yr I'm still learning HTML and CSS but I have improved a lot in the past couple of days. Still struggling with this though I have tried lots of different ways and none of them have worked. See the screenshot below. Any idea how I could add a margin to the left of the map so that it is aligned with the text above? I'm pretty certain it is possible. Alex.
June 20, 201115 yr Hey Alex Have you tried to wrap the Map inside of a div? then position that div using margin: auto; or margin-left in the css? Lewi
June 20, 201115 yr Author I have tried this but it confuses me as the map is a script so I wouldn't be too sure where to place the element in the document. Would the css be added as an attribute or an element?
June 20, 201115 yr Hey I'd probalys go for an element, i'll show you what i would do. <div id="map"> <script>google map thing</script> </div> #map { width: xx px; height: xx px; margin-left: 5px; } i'd go for something like that to postion the map on the page. Lewi
June 20, 201115 yr Author That was very similar to what I had tried earlier except I just realised I had put the closing division tag in the wrong place. Unfortunately this still hasn't worked. Where would you place the following? #map { width: xx px; height: xx px; margin-left: 5px; } I have put it in the head of the document not sure if that is correct though. Alex.
June 20, 201115 yr If you have a stylesheet you want to place it in their and remeber to change the xx in width and height to the width and height of your map Lewi
June 20, 201115 yr Author See that's probably my problem as I am new I didn't want the fuss of using a style sheet so I've been working in the html document itself. No reason why it shouldn't work still though. I'll keep trying thanks anyway.
June 20, 201115 yr Ah thats fine, but once you get more confident it's good to use one and it makes it more easier to build i found! if so just try placing this code inside the of the head tags inside. <style type="text/css"> #map { width: xx px; height: xx px; margin-left: 5px; } </style>
June 20, 201115 yr Author I managed to get the first one you gave me working. At first I couldn't find the correct width and height of the map but instead I just used 100% for both which worked out fine and now my map has a nice 15px margin ha. Thank you Lewis.
June 20, 201115 yr Glad to hear you've got it working! Just keep learning and picking up tips and most stuff will come to you easy All the best Lewi
Create an account or sign in to comment