5

I'm working on a web app that will allow users to enter content and then submit it out to people's phones. It works like a charm, but I'm having some problem with the logo. The logo is the following:

enter image description here

I have a button on the left that is a different link, which is why we don't want the logo link to cover it up.

My first idea was to use a border-radius, but the angle at the bottom is too sharp for that. For example, if I use a border radius of: 0 0 75px 75px, it does the following:

enter image description here

So, if we make the angles bigger, let's say to: 0 0 100px 100px, it does the following:

enter image description here

(There's no difference.)

If I increase the bottom left, it pushes out the bottom right, and vice versa. I ended up doing the following because there's no link on the right side.

enter image description here

There's still a small, minor space on the left, but it's way better. Except now there's a big link on the right, which might bother the end user because there shouldn't be anything there.

So, we chose to use image maps and did the following:

enter image description here

And that works! ... kinda. The bottom left corner of the image now, above the red link, is a dead space. So, an alternative is we then make the bottom corner a different link. Let me illustrate.

enter image description here

That fixes that. Until the user scrolls. As you can see, the logo (and header) are fixed. The navigation is not. The following then happens.

enter image description here

I'm using jQuery so it won't be hard then to get the distance scrolled, compare it to what navigation item is in that area and change that section of the image map to match it... but I feel I'm overkilling this.

(And then, to top it off, different users have a different navigation...)

Do you know of a similar solution? Or am I stuck with image maps and jquery link changes?

Thanks a lot!

Edit: To confirm the "dead space" I was linking to, please review the image below:

enter image description here

Even though the image map is around the shield, the shield is still an image and has square corners, leaving the corners an unlinkable area, unless another image map is made for that area. I did that, but because the navigation scrolls, that linked area no longer matches the navigation below it. A border-radius on the image map would kind of fix the issue also, but I've gone with a different approach.

Hopefully that answers the question!

3
  • 1
    Can I ask why you're needing to link the deadspace? Surely you could just take the href out of the img tag and add it to the image map element in question? Or am I missing something?
    – shennan
    Nov 20, 2013 at 17:44
  • 1
    Do you know that you can set two separate border radii with the slash syntax? E.g. border-radius: 0 0 50px 50px / 0 0 100px 100px for an x-radius of 50px and a y-radius of 100px. Try playing around with making the y-radius larger than the x-radius, you will get a sharper shield shape (although still not tapering down to a point at the bottom). Nov 21, 2013 at 17:46
  • Sorry for the delay. We're using this for a major sporting event this weekend and I had to get other stuff done. When I had the area around the shield as the image map, the bottom corners were still in the image map, but they had no link, and then caused a "dead zone". I'll attach a picture. I have chosen isherwood's answer, but I do appreciate your response. And Jordan, I do know about that syntax. It's cool! Thanks! Nov 22, 2013 at 16:53

2 Answers 2

5

You might be able to revisit your CSS approach with this CSS3 badge shape technique:

http://jsfiddle.net/isherwood/2v2wM

#shield {
    position: relative;
    width: 140px;
    height: 100px;
    background-color: navy;
    border-radius: 0 0 50px 50px;
    display: inline-block;
}
#shield:before, #shield:after {
    position: absolute;
    margin-top: 30px;
    content:"";
    left: 70px;
    top: 0;
    width: 70px;
    height: 115px;
    background: navy;
    border-radius: 50px 50px 0 0;
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);
    -webkit-transform-origin: 0 100%;
    -moz-transform-origin: 0 100%;
    -ms-transform-origin: 0 100%;
    -o-transform-origin: 0 100%;
    transform-origin: 0 100%;
}
#shield:after {
    left: 0;
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
    -webkit-transform-origin: 100% 100%;
    -moz-transform-origin: 100% 100%;
    -ms-transform-origin: 100% 100%;
    -o-transform-origin: 100% 100%;
    transform-origin :100% 100%;
}

The shape's not quite right, but with some adjustments it should work nicely.

1
  • 1
    Hey thanks! That works great. Only IE8 doesn't support MX Filters on pseudo, and Javascript can't rotate them because they aren't actually elements, but that does solve the problem in all modern browsers. Thanks! Nov 22, 2013 at 17:04
2

To elaborate on my comment, you can add href links directly to the image map elements:

<img src="logo.jpg" usemap="#logo" border="0">
<map name="logo">
  <area shape="polygon" coords="[long list of coordinates]" href="www.mylink.com">
</map>

Not sure if I'm missing something in your example...

3
  • I think the OP is saying that the shield moves, depending on scrolling and layout, so the "dead space" link cannot be determined in advance.
    – Jeff B
    Nov 21, 2013 at 17:38
  • Perhaps. But there should still be a way to implement it using the (better-supported?) image map. As a side note, it would help if the OP returned to his popular question and shed a little more light on what he's doing...
    – shennan
    Nov 21, 2013 at 18:32
  • Sorry. OP's been busy preparing for the Grey Cup. I chose isherwood's answer, but just for classification I made an edit to my question so you can see what I meant. Thanks a lot! Nov 22, 2013 at 17:06

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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