3

I'm working on setting up the attributions for a map, and I'm wondering how to access more the styling options for the attribution control.

I've modified the .ol-attribution ul {} css property to display the items in a vertical list (display: table), but the default MapQuest attribution shows up on 3 lines instead of 1. Is this something I can fix? The line below is another layer I have. Also, is there a way to configure where the logos will be placed? I've read documentation but didn't find anything that gets so fine-grained. I also tried overwriting the ol.source.MapQuest({ attribution: ...}) with all the same words/links in a single html line, but the stock attribution still shows up.

enter image description here

Also, when the MapQuest layer is removed, it text continues to wrap in a funny way:

enter image description here

1

You can override the look and feel of ol-attribution class in your CSS. Also you can provide your own CSS class:

var attribution = new ol.control.Attribution({
    className: "yolo"
});

Note that in this case, the ol-attribution class will not be added to the element.

For your problem with list you should not use display:table but display:block on the ul and display:list-item on the li. You will then get a vertical list that behave better.

  • thanks for the feedback. results: setting the ul to display:block made it so the attribution was not collapsible, so that's not going to work... also, when I set the class name to 'att' (and don't include any css for that class) the control doesn't show up on the map. could you explain the use of changing the class name? – mr.adam Feb 3 '15 at 22:00
  • display:block does not prevent to collapse the control. Are your sure you don't have extra css/code that would be to blame? I tried on a basic map and it works. Don't forget to set style on the li's as well.For the class name, you don't see anything because you have to define the CSS yourslef. Since ol-attribution is no more added to the ul any CSS related to this class is no longer here but the HTML still is. You have to define your own CSS then. – htulipe Feb 4 '15 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.