我想在 DIV 中居中放置一个 DIV 而不是文本,所有的解决方案都说要指定我的宽度并将边距设置为自动,但是如果它是一个响应式构建,它是如何工作的,就像我设置它不会的宽度一样是?我想对齐联系信息 DIVS 而不是文本。希望已经足够清楚了。
谢谢!
<div id="upperfooter">
<div class="container">
<div id="links">
<div class="contact-info col-lg-offset-0 col-lg-3 col-xs-4 col-md-offset-0 col-md-4">
<div class="contact-item">
<h3><strong>COMPANY INFO</strong></h3>
<p>About Nielsen</p>
<p>Investor Relations</p>
<p>Nielsen Families</p>
<p>Responsibility & Sustainability</p>
<p>Press Room</p>
<p>Careers</p>
<p>Contact Us</p>
</div>
</div>
<div class="contact-info col-lg-offset-0 col-lg-3 col-xs-4 col-md-offset-0 col-md-4">
<div class="contact-item">
<h3><strong>INSIGHTS</strong></h3>
<p>Newswire</p>
<p>Reports</p>
<p>News Center</p>
<p>Top 10 & Trends</p>
<p>How We Measure</p>
<p>Webinars & Events</p>
<p>Newsletter Sign-up</p>
</div>
</div>
<div class="contact-info col-lg-offset-0 col-lg-3 col-xs-4 col-md-offset-0 col-md-4">
<div class="contact-item">
<h3><strong>SOLUTIONS</strong></h3>
<p>Advertising Effectiveness</p>
<p>Audience Measurement</p>
<p>Marketing ROI</p>
<p>Price and Promotion</p>
<p>Product Development</p>
<p>Reputation Management</p>
<p>Shopper</p>
</div>
</div>
</div>
</div>
</div>
最佳答案
您应该将 position: relative
添加到主 div 并在对我有用的 contact div 上设置较小的宽度。
关于html - DIV 而非文本的响应中心对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53075426/