Fix footer table/div issue - html

I'm trying to align three small logos in a footer widget in a single line (using Wordpress, theme is Press coders) I've created a mock up of what I want at:
Image
However everything is skewing beyond belief!
You can see the mess in my footer at:
www.oxfordlifestylecentre.co.uk
I've tried using both a div and a table, my latest table looks like:
<table align="right">
<tr>
<td>
<a href="/gym/">
<img src="http://www.oxfordlifestylecentre.co.uk/wp-content/uploads/2014/07/health-and-fitness-1.jpg" alt="Health and Fitness" />
</td>
<td>
<a href="/hair-and-beauty/>
<img src="http://www.oxfordlifestylecentre.co.uk/wp- content/uploads/2014/07/hair-and-beauty-1.jpg" alt="Hair and Beauty" />
</td>
</tr>
</table>

You html syntax is wrong. You are missing closing anchors and quotation marks. Try this.
<table align="right">
<tr>
<td>
<a href="/gym/">
<img src="http://www.oxfordlifestylecentre.co.uk/wp-content/uploads/2014/07/health-and-fitness-1.jpg" alt="Health and Fitness" /></a>
</td>
<td>
<a href="/hair-and-beauty/">
<img src="http://www.oxfordlifestylecentre.co.uk/wp- content/uploads/2014/07/hair-and-beauty-1.jpg" alt="Hair and Beauty" /></a>
</td>
</tr>
</table>

Try this, Fiddle
<div class="logos">
<a href="/gym/">
<img src="http://www.oxfordlifestylecentre.co.uk/wp-content/uploads/2014/07/health-and-fitness-logo.jpg" alt="Health and Fitness" />
</a>
<a href="/hair-and-beauty/">
<img src="http://www.oxfordlifestylecentre.co.uk/wp-content/uploads/2014/07/hair-and-beauty-logo.jpg" alt="Hair and Beauty" />
</a>
<a href="/nutrition-and-refreshment/">
<img src="http://www.oxfordlifestylecentre.co.uk/wp-content/uploads/2014/07/nutrition-and-refreshment.jpg" alt="Nutrition and Refreshment" />
</a>
</div>
.logos {
float: right;
clear: right;
width: 500px;
height: 50px;
}
.logos img {
height: 80%;
}
.logos a {
text-decoration: none;
}
*Note: For the best effects resize images to same size.

As pointed out by previous answers, your HTML syntax is wrong. However, using tables for that is not the correct approach. You can simply keep the links and images inline and text-align right.
It depends on the complexity of the layout, but display:inline-block may be needed or you might need to wrap certain elements in a container. Either approach is superior to using tables for layout (Why not use tables for layout in HTML?)
HTML
<img src="http://placekitten.com/g/200/300" /><img src="http://placekitten.com/g/200/300" /><img src="http://placekitten.com/g/200/300" />
CSS
body {
text-align: right;
}
a {
margin-right: 10px;
}
http://jsbin.com/wuvoriye/1/edit

Ok so where to start:
1: dont use a table.
2: dont use a table.
3: you get the picture here....
Now for the fix:
I have left comments into it for you so to explain what I did.
I put in inline style for you so just add it to your css file.
<section class="footer-widget-container">
<div id="footer-widget-area" class="inside widget-area">
<!-- Social Media Div First -->
<div id="pc_info_widget_designfolio-pro-3" class="widget pc_info_widget" style="width: 40%; float: left;">
<!-- simple p tag with a class is all that needed -->
<p class="phone" style="margin: 0; padding: 0;">
(949) 867-5307
</p>
<!-- keep it simple: list items floated left + you can now just add as many as you want -->
<ul style="float: left; margin: 0; padding: 0;">
<li style="float: left; list-style: none;">
<a class="sm-icon" target="_blank" href="http://www.facebook.com//lifestyle-center">
<img width="32" height="32" alt="Facebook" src="http://www.oxfordlifestylecentre.co.uk/wp-content/themes/designfolio-pro/images/facebook.png">
</a>
</li>
<li style="float: left; list-style: none;">
<a class="sm-icon" target="_blank" href="http://twitter.com//lifestylecentre">
<img width="32" height="32" alt="Twitter" src="http://www.oxfordlifestylecentre.co.uk/wp-content/themes/designfolio-pro/images/twitter.png">
</a>
</li>
</ul>
</div>
<!-- Logo Div Second -->
<div id="text-8" class="widget widget_text" style="width: 60%; float: left;">
<div class="textwidget">
<!-- Dont use tables unless its table data | Simple ul list itmes float left again -->
<ul style="float: right;">
<li style="float: left; list-style: none;">
<a href="/gym/">
<img alt="Health and Fitness" src="http://www.oxfordlifestylecentre.co.uk/wp-content/uploads/2014/07/health-and-fitness-1.jpg">
</a>
</li>
<li style="float: left; list-style: none;">
<a href="/hair-and-beauty/">
<img alt="Hair and Beauty" src="http://www.oxfordlifestylecentre.co.uk/wp-content/uploads/2014/07/hair-and-beauty-1.jpg">
</a>
</li>
</ul>
</div>
</div>
</div>
</section>

Related

How to add Side by Side Image with A Gap Between Them?

I've been trying to solve this for almost 6 hours just to get this to be responsive on mobile. Will someone please help me? It's really difficult and I really want to finish this homework.
I wanted it to look like this, but mobile responsive: https://imgur.com/kRcHUDJ
I only use HTML and inline CSS, hopefully, there is a solution to this.
<center>
<div id="home-secondary" style ="display: inline-block";>
<ul id="homepageGuide">
<a href="/blog/"><img class="img-responsive" data-original="/uploads/button-1.png" />
<p><img src="https://cdn.theatlantic.com/assets/media/img/mt/2019/07/GettyImages_138965532/lead_720_405.jpg?mod=1563813032" width="500px" alt="example one"></p>
<span class="color-overlay"></span>
</a></ul>
</div>
<div id="home-secondary" style ="display: inline-block";>
<ul id="homepageGuide">
<a href="/testimonials.php">
<img class="img-responsive" data-original="/uploads/button-2.png" />
<p><img src="https://cdn.theatlantic.com/assets/media/img/mt/2018/11/shutterstock_552503470/lead_720_405.jpg?mod=1541605820" width="500px" alt="example two"></p>
<span class="color-overlay"></span>
</a></ul>
</div>
</center>
Demo here: https://codepen.io/anon/pen/WVpwwX
It does appear to be working great on desktop, what I wanted to achieve is given; but when it comes to mobile, the results aren't great. I had to scroll to the right just to see the full image.
My expected output is to have the images stacked up together when viewed on mobile. Thanks guys.
Almost there. The images need to have a max-width set for mobile devices so they will resize automatically instead of flowing off the screen because of their 500px width setting. Set display to inline-block as well:
https://codepen.io/ZorlacMeister/pen/PMpNRK
You can test easily in Chrome. Hit F12, then click on the little icon that looks like two mobile devices standing upright next to each other, then RELOAD the page to see the mobile layout.
HTML
<center>
<div id="home-secondary" style ="display: inline-block">
<ul id="homepageGuide">
<a href="/blog/"><img data-original="/uploads/button-1.png" />
<p><img class='img-responsive' src="https://cdn.theatlantic.com/assets/media/img/mt/2019/07/GettyImages_138965532/lead_720_405.jpg?mod=1563813032" width="500px" alt="example one"></p>
<span class="color-overlay"></span>
</a></ul>
</div>
<div id="home-secondary" style ="display: inline-block">
<ul id="homepageGuide">
<a href="/testimonials.php">
<img data-original="/uploads/button-2.png" />
<p><img class='img-responsive' src="https://cdn.theatlantic.com/assets/media/img/mt/2018/11/shutterstock_552503470/lead_720_405.jpg?mod=1541605820" width="500px" alt="example two"></p>
<span class="color-overlay"></span>
</a></ul>
</div>
</center>
CSS
.img-responsive {
max-width:75%;
display: inline-block;
}
You can use a grid layout to achieve this.
grid-gap: 1em; specifies your padding between elements
center {
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 1em;
}
img {
max-width: 100%;
}
<center>
<div id="home-secondary" style="display: inline-block" ;>
<ul id="homepageGuide">
<a href="/blog/"><img class="img-responsive" data-original="/uploads/button-1.png" />
<p><img src="https://cdn.theatlantic.com/assets/media/img/mt/2019/07/GettyImages_138965532/lead_720_405.jpg?mod=1563813032" width="500px" alt="example one"></p>
<span class="color-overlay"></span>
</a>
</ul>
</div>
<div id="home-secondary" style="display: inline-block" ;>
<ul id="homepageGuide">
<a href="/testimonials.php">
<img class="img-responsive" data-original="/uploads/button-2.png" />
<p><img src="https://cdn.theatlantic.com/assets/media/img/mt/2018/11/shutterstock_552503470/lead_720_405.jpg?mod=1541605820" width="500px" alt="example two"></p>
<span class="color-overlay"></span>
</a>
</ul>
</div>
</center>
I set the image width to 100% and used a class named column on the <ul> to set the box-sizing, float a relative width and display.
I also set the <ul> paddings to 2.5%.
Check it on Codepen or below
.column {
box-sizing: border-box;
float: left;
width: 50%;
display: inline-block;
}
ul{
padding-left: 2.5%;
padding-right: 2.5%;
}
<center>
<ul class="homepageGuide column">
<a href="/blog/"><img class="img-responsive" data-original="/uploads/button-1.png" />
<p>
<img src="https://cdn.theatlantic.com/assets/media/img/mt/2019/07/GettyImages_138965532/lead_720_405.jpg?mod=1563813032" width="100%" alt="example one">
</p>
<span class="color-overlay"></span>
</a>
</ul>
<ul class="homepageGuide column">
<a href="/testimonials.php">
<img class="img-responsive" data-original="/uploads/button-2.png" />
<p>
<img src="https://cdn.theatlantic.com/assets/media/img/mt/2018/11/shutterstock_552503470/lead_720_405.jpg?mod=1541605820" width="100%" alt="example two">
</p>
<span class="color-overlay"></span>
</a>
</ul>
</center>

Div inline not working

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>
<img style="vertical-align: middle; background-color:#000;" src="<?php echo get_template_directory_uri(); ?>/images/marketing_ignite_logo.png" />
</div>
<div>
<img src="<?php echo get_template_directory_uri(); ?>/images/logo.gif" alt="Logo Buyseoleads">
</div>
<div class="seenBefore2" style="font-size:26px;">
<span>As seen on</span>
</div>
<div>
<img style="vertical-align: middle; background-color:#000;" src="<?php echo get_template_directory_uri(); ?>/images/release_wire_logo.png"/>
<!--img src="<?php //echo get_template_directory_uri(); ?>/images/daily-news-newspaper-headline.jpg" alt="Daily News Newspaper Headline"-->
</div>
</div>
Not a lot to go on here but I'll give it a try.
Every <div> has block context by default. Setting display: inline; on a parent <div> will not get inherited by child <div>s. Apply display: 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.
ul,
li {
margin: 0;
padding: 0;
list-style: none;
}
li {
padding: 3px 6px;
float: left;
}
li img {
vertical-align: middle;
}
<header>
<nav>
<ul>
<li>As seen on
<a href="#">
<img src="http://placehold.it/50x50/ffcc00/">
</a>
</li>
<li>As seen on
<a href="#">
<img src="http://placehold.it/50x50/cc0000/">
</a>
</li>
</ul>
</nav>
</header>
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 property
.header div {
float: left;
}
But 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/
<div style="width: 100%; position: relative;">
<div style="float: left; margin-right: 10px;">
<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="http://placehold.it/350x150" /> </a>
</div>
</div>
<div style="float: left; margin-right: 10px;">
<div style="font-size:26px;"><span> As seen on</span></div>
<div>
<img src="http://placehold.it/350x150" alt="Logo Buyseoleads">
</div>
</div>
</div>
span{
margin:0;
padding:0;
}
or
span{
display:block;
float:left;
padding:0 10px;
}
For this question,You should set the display:inline attribute for all of the inner divs, not for the outer div.

Can't center title because of social media icons?

I have put social media icons on the right side of my html, but I can't center my title anymore, how can I fix this?
I've tried text-align: center already, and it doesn't work.
#socialm{
float:right;
}
#socialm ul li{display: inline;}
<header>
<div id="socialm">
<img src="facebook.png" width= "45px" height="45px"/>
<img src="instragram.png" width= "45px" height="45px"/>
<img src="youtube.png" width= "45px" height="45px"/>
</div>
<h1>Photography and visual arts</h1>
</header>
You can't do this without absolutely positioning one of the elements.
Absolute positioning takes the element out of the flow so it ignores the other elements around it.
Here I positioned the 'social' div on the right instead of floating it. As you can see the heading is now centered.
You can also see the downside of positioning..without careful sizing, you get overlap. Media queries can address this.
#socialm {
position: absolute;
right: 0;
}
#socialm ul li {
display: inline;
}
header {
text-align: center;
}
<header>
<div id="socialm">
<a href="https://www.facebook.com" target="_blank">
<img src="http://placekitten.com.s3.amazonaws.com/homepage-samples/96/140.jpg" width="45px" height="45px" />
</a>
<a href="https://www.instagram.com" target="_blank">
<img src="http://placekitten.com.s3.amazonaws.com/homepage-samples/96/140.jpg" width="45px" height="45px" />
</a>
<a href="https://www.youtube.com/channel/..." target="_blank">
<img src="http://placekitten.com.s3.amazonaws.com/homepage-samples/96/140.jpg" width="45px" height="45px" />
</a>
</div>
<h1>Photography and visual arts</h1>
</header>
JSFiddle Demo
I'm not sure if this is what you are looking for, but I simply just added text-align:center; to your h1 tag.
Here is the solution:
http://codepen.io/Glenvig/pen/dMeaQm

How to automatically adjust span with its outer div

I have an outer div 'draggable', If we write a very big content, it automatically gets expanded, but the span width remains fixed.
HTML
<div id="draggable" class="ui-widget-content" style="word-break: keep-all">
<span class="too" >
<div id="symbol" style="POSITION: relative;float:right;">
<span class='switch-icons'>-</span>
<a id="switch"><img id="img1" src="images/minus.png" alt="minus" height="15" width="15" ></a>
<a onclick="javascript:closeFullScreenView()"><img src="images/close-bt.png" alt="close" height="15" width="15" ></a>
</div>
<p class="ui-widget-header" style="FLOAT: left">
FileNo.:
<s:property value="fileNo"/>
</p>
</span>
<div id="ajaxContent" style="overflow-Y:auto;">
</div>
</div>
CSS
.too {
width: auto;
display: block;
float: right;
}
The span having class 'too' is not expanding accordingly. I have tried float as well, but its not working.
I tried this and it is working fine for me. It may be some other styles in your code causing this issue. Could you please post a fiddle , so that we can check more on this.

Stretch navigation bar of images across page?

I am sure this has been asked before so I apologize but I cant find an answer that works for me - or perhaps I just don't understand.
I am new in HTML & CSS and I am trying to build a navigation bar of images that stretches to 100% of the width of the screen. It would be great if someone could show me what I am missing. The links are going to be changed later.
<body>
<ul>
<li><a href="index.html">
<img src="images/logo.png" height="80" width="150">
</a>
</li>
<div id="menu">
<li>
<a href="index.html">
<img src="images/homeButton.png" height="80" width="150"></a>
</li>
<li>
<a href="index.html">
<img src="images/scratchButton.png" height="80" width="150">
</a>
</li>
<li>
<a href="index.html">
<img src="images/c++Button.png" height="80" width="150">
</a>
</li>
<li>
<a href="index.html">
<img src="images/PythonButton.png" height="80" width="150">
</a>
</li>
<li>
<a href="index.html">
<img src="images/signInButton.png" height="80" width="150">
</a>
</li>
</div>
</ul>
.
html, body {
margin: 0;
padding: 0;
}
ul {
margin: 0;
padding: 0
}
li {
float: left;
}
a {
}
#menu {
width: 100%;
list-style-type: none;
background-color: #000000;
}
#menu :hover{
background-color: yellow;
}
You could use a table and specify the columns as equal widths and place it in a div which occupies 100% of the width.
E.g.:
<div id="container">
<table>
<col width="20%">
<col width="20%">
<col width="20%">
<col width="20%">
<col width="20%"> // maybe you can make all five statements at once
<tr>
<td>1st/td>
<td>2nd</td>
<td>3rd</td>
<td>4th</td>
<td>5th</td>
</tr>
</table>
</div>
And