我有一个正在使用的自定义 wordpress 主题,我正在编辑我的一个页面。我创建了 3 个 div,它们基本上应该在页面中心水平对齐。我想出了如何让一切正确对齐,但我需要它能够响应。当我从移动设备查看网页时,div 甚至没有完全显示在屏幕上并且没有滚动条。
请查看图片以了解它的外观。这三个 div 显示“查找答案、提交票证和与代理聊天”链接:
这是我创建这些 div 的代码:
<center>
<div style="width: 900px;">
<a href="http://neawebservices.com/client/knowledgebase.php" target="_blank"><div style="float: left; width: 200px; margin-right: 20px; border-radius: 25px; border: 2px solid #007ebf; padding: 20px; height: 150px; text-align: center;">
<h3 class="priceplanhr">Find Answers</h3>
<img class="alignnone wp-image-980 size-full" src="http://neawebservices.com/wp-content/uploads/2016/04/64-X-64.png" alt="" width="66" height="44" />
</div></a>
<a href="https://neawebservices.com/client/submitticket.php" target="_blank"><div style="float: left; width: 200px; margin-right: 20px; border-radius: 25px; border: 2px solid #007ebf; padding: 20px; height: 150px; text-align: center;">
<h3 class="priceplanhr">Submit a Ticket</h3>
<img class="alignnone wp-image-980 size-full" src="http://neawebservices.com/wp-content/uploads/2016/04/128-X-128-3.png" alt="" width="66" height="44" />
</div></a>
<a href="javascript:void(Tawk_API.toggle())"><div style="float: left; width: 200px; margin-right: 20px; border-radius: 25px; border: 2px solid #007ebf; padding: 20px; height: 150px; text-align: center;">
<h3 class="priceplanhr">Chat with an Agent</h3>
<img class="alignnone wp-image-980 size-full" src="http://neawebservices.com/wp-content/uploads/2016/04/64-X-64-1.png" alt="" width="55" height="55" />
</div></a>
</div>
</center>
主题使用外部 css,但如果我可以使用内联 css 获得相同的响应效果,那就太好了。
如果我能在这方面得到任何帮助,我将不胜感激!
最佳答案
CSS3 media queries是你的 friend 吗,不,他们不能在线完成。无论如何,通常最好不要使用内联 CSS。
您可以构建自己的媒体查询(请参阅 here )或将您的主题转换为 CSS 框架,例如 Bootstrap或 Foundation (我个人更喜欢基金会)为你做。
关于html - 如何使用自定义 wordpress 主题使 div 响应?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36707410/