I want to display the menu in inline form but it’s not working .Any help ?(Don’t worry about the pictures).Here is a screenshot of what I want to achieve.The “As seen ” will occupy the red holder on the screenshot.
<div class="header" style="display:inline;">
<div style="font-size:26px;">
<span> As seen on</span>
</div>
<div>
<a href="https://www.marketingignite.com/basic-commonsensical-seo-tips-and-tricks/" target="_blank"><img style="vertical-align: middle; background-color:#000;" src="<?php echo get_template_directory_uri(); ?>/images/marketing_ignite_logo.png" /></a>
</div>
<div>
<a href="<?php echo esc_url(home_url()); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/logo.gif" alt="Logo Buyseoleads"></a>
</div>
<div class="seenBefore2" style="font-size:26px;">
<span>As seen on</span>
</div>
<div>
<a href="http://www.releasewire.com/press-releases/explaining-the-advantage-of-verified-and-exclusive-ppc-and-seo-leads-how-buy-seo-leads-helps-agencies-achieve-greater-success-and-conversions-549381.htm" target="_blank"><img style="vertical-align: middle; background-color:#000;" src="<?php echo get_template_directory_uri(); ?>/images/release_wire_logo.png"/></a>
<!--img src="<?php //echo get_template_directory_uri(); ?>/images/daily-news-newspaper-headline.jpg" alt="Daily News Newspaper Headline"-->
</div>
</div>
5
Answers
The problem is that
display: inline;
won’t allow any block styling. And you used it on block element. If you want elements to be on the same line, you should consider using, for example, float propertyBut do not forget about clearing the floats.
If I understand you correctly, you want your blocks (as seen on, with image) in a row? If so, you can use floats. Note also I have replaced your images with placeholdit ones.
https://jsfiddle.net/aa8zs200/
Not a lot to go on here but I’ll give it a try.
Every
<div>
has block context by default. Settingdisplay: inline;
on a parent<div>
will not get inherited by child<div>
s. Applydisplay: inline;
to all<div>
. Use<span>
instead of<div>
as it’s an inline element by default and won’t try to take up the whole width of the parent element by default.Personally I would change the markup a bit if you’re Looking to create a menu. Use
<nav>
,<ul>
,<li>
,<a>
etc. instead. Perhaps something like I have below.or
For this question,You should set the
display:inline
attribute for all of the inner divs, not for the outer div.