当前位置: 动力学知识库 > 问答 > 编程问答 >

Prevent CSS media queries from breaking when doing masked domain forwarding

问题描述:

I recently set up a domain I own - jeffreydill.com - to point to a personal site I have hosted on GitHub - jeffdill2.github.io/portfolio. It's a GoDaddy domain and I'm using masked domain forwarding.

However, when using the forwarded address - jeffreydill.com - all of my CSS media queries break. If I just go straight to the actual domain - jeffdill2.github.io/portfolio - everything is still working correctly.

Any help would be much appreciated. Thanks!

网友答案:

OK, I figured out the issue.

When you do domain-forwarding from GoDaddy using the Masking option, the page you're forwarding to is displayed inside an iFrame on the page you're forwarding from. Because it's being displayed inside of an iFrame, it doesn't respond to the size of the viewport - which renders the media queries useless.

网友答案:

Why don't you use a full link on your css files?

<link rel="stylesheet" href="http://jeffdill2.github.io/portfolio/styles/vendor.css">

Any way, you may not want to so...

Your next option is to use the base meta (info here: http://www.w3schools.com/tags/tag_base.asp) This will convert all relatives link on the url path you want.

分享给朋友:
您可能感兴趣的文章:
随机阅读: