i'm a little rusty on html and css and i cant get 2 images to float, one on top of the other. heres the code...
<div class="kbody">
<img class="kimg1" src="img1.jpg" alt=" " width="375px" height="auto">
<div id="ktxt">
<p>          
Kristallnacht occurred on November 9-10, 1938. Also known as the night of
broken glass, it was an organized attack on the Jews. Hitler had Nazis all over
Germany and Austria that burned synagogues, broke store windows, stole from the
stores, killed a couple dozen Jews, and arrested twenty thousand more. A few days
later Germany made an "atonement fine" that added up to over one billion dollars
and placed it on the remaining Jews. </p>
</div>
<img class="kimg2" src="img3.jpg" alt=" " width="375px" height="auto">
</div>
and the css...
.kbody {
width:800px;
margin-left: auto;
margin-right: auto;
/*border-style:solid;
border-width:3px;*/
}
.kimg1 {
padding-left:5px;
padding-top:5px;
padding-bottom:5px;
float:left;
}
.kimg2 {
padding-left:5px;
padding-top:5px;
padding-bottom:5px;
float:left;
margin-top:10px;
}
#ktxt {
padding-left:10px;
padding-right:10px;
padding-top:10px;
/*border-width:2px;
border-style: solid;*/
width:350px;
height:330px;
margin-left:402px;
font-style:arial, sans-serif;
color: #336699;
font-size:14pt;
}
what am i doing wrong??
heres what it looks like with this code
http://imgur.com/a/ivDE2#0
To move the second image under the first:
.kimg2 {
clear: both;
}
<div class="kbody">
<img class="kimg1" src="img1.jpg" alt=" " width="375px" height="auto">
<div id="ktxt">
<p>          
Kristallnacht occurred on November 9-10, 1938. Also known as the night of
broken glass, it was an organized attack on the Jews. Hitler had Nazis all over
Germany and Austria that burned synagogues, broke store windows, stole from the
stores, killed a couple dozen Jews, and arrested twenty thousand more. A few days
later Germany made an "atonement fine" that added up to over one billion dollars
and placed it on the remaining Jews. </p>
</div>
<img class="kimg2" src="img3.jpg" alt=" " width="375px" height="auto">
<div style="clear:both"></div>
</div>
Put a clearfix between the elements you want to show them in separate lines. I would write a global css rule like .clearfix { clear: both; } and put a div before the second image;
Instead of writing bunch of use CSS text-indent property;
Sample Code:
<div class="kbody">
<img class="kimg1" src="img1.jpg" alt=" " width="375px" height="auto">
<div id="ktxt">
<p>
Kristallnacht occurred on November 9-10, 1938. Also known as the night of
broken glass, it was an organized attack on the Jews. Hitler had Nazis all over
Germany and Austria that burned synagogues, broke store windows, stole from the
stores, killed a couple dozen Jews, and arrested twenty thousand more. A few days
later Germany made an "atonement fine" that added up to over one billion dollars
and placed it on the remaining Jews.
</p>
</div>
<div class="clearfix"></div>
<img class="kimg2" src="img3.jpg" alt=" " width="375px" height="auto">
</div>
try to wrap your image
html
<div class="kbody">
<div class="imageWrapper">
<img class="kimg1" src="img1.jpg" alt=" " width="375px" height="auto" />
<img class="kimg2" src="img3.jpg" alt=" " width="375px" height="auto" />
</div>
<div id="ktxt">
<p>          
Kristallnacht occurred on November 9-10, 1938. Also known as the night of
broken glass, it was an organized attack on the Jews. Hitler had Nazis all over
Germany and Austria that burned synagogues, broke store windows, stole from the
stores, killed a couple dozen Jews, and arrested twenty thousand more. A few days
later Germany made an "atonement fine" that added up to over one billion dollars
and placed it on the remaining Jews. </p>
</div>
</div>
css
.imageWrapper {
float:left;
width:375px;
}
hope this help you
easier way is <img src="yourimage.jpg" align="left" />
As you want your picture to be floated to left side is not possible as you do. So, you should define your html alternatively for what you want as..
<div class="kbody">
<div class="kimg">
<img ..image1../>
<img ..image2../>
</div>
<div id="ktext">your text...</div>
</div>
Now define the css.
hints:
.kimg{width: 300px;}
#ktext{width: 300px;}
Related
I would like to add spacing between these div elements.
How can I do that?
<div style="clear: left;">
<p class="image"><img src="https://blog.proven.com/wp-content/uploads/zipsqaure.jpg" height="200" width="200" border="1px"></p>
<p class="rating"><strong><font size="4">Proven Rating: <font color="#0077b3">★★★★★</font></font></strong></p>
<p class="description">ZipRecruiter allows employers to post jobs within minutes and reach over 200 million active job seekers. </p>
</div>
<div style="clear: left;">
<p class="image"><img src="https://blog.proven.com/wp-content/uploads/snag-1.png" height="200" width="200" border="1px"></p>
<p class="rating"><strong><font size="4">Proven Rating: <font color="#0077b3">★★★★★</font></font></strong></p>
<p class="description">Snagajob allows employers to reach over 80 million job seekers through their job board. It was founded in 1999 and continues to be one of the top job boards today, hosting one of the largest hourly employee networks on the web.</p>
</div>
Define a margin for each element or
use Something like this to set it to all elements within a div
div *{
margin:10px;
}
I have a set of CSS columns that I programmed and they work for the first 2 rows and then begin to stack incorrectly. I have tried different widths but to no avail.
You can see the problem live here: http://innerwestadv.com/dev/?page_id=10. It starts stacking wrong right under Market & Media Research. If I take out this row it stacks better but I am not sure what the difference is.
It is a wordpress 3.9.2 website using the NIVAN theme.
I have marked in the HTML where the code breaks.
CSS
.one-eighth {
width:7%;
margin:10px 1.5% 10px 0;
float:left;
}
.three-eighths {
width:38%;
margin:10px 3.5% 10px 0;
float:left;
}
.last {
margin:10px 0;
}
#media screen and (max-width: 768px) {
.one-eighth {
width:100%;
margin:0;
}
.three-eighths {
width:100%;
margin:0;
}
}
HTML
<div class="one-eighth">
<img class="alignleft size-thumbnail wp-image-221" src="http://innerwestadv.com/dev/wp-content/uploads/2014/08/Advertising1-150x150.png" alt="Advertising" width="150" height="150" /></div>
<div class="three-eighths">
<strong>Advertising & Public Relations</strong>
Before your customers can love your company, they must find your company. We will help you put your best foot forward.</div>
<div class="one-eighth">
<img class="alignleft size-thumbnail wp-image-214" src="http://innerwestadv.com/dev/wp-content/uploads/2014/08/Marketing-Plan-Development-150x150.png" alt="Marketing Plan Development" width="150" height="150" /></div>
<div class="three-eighths last">
<strong>Marketing Plan Development</strong>
Do you know what your business is about? What you do and don't do? What your ultimate goals are? Our development plan encompasses more than marketing: it not only answers those questions, but includes the words that spell out the purpose of your company in inspiring language.</div>
<!-- Removing this Row helps some -->
<div class="one-eighth">
<img class="alignleft size-thumbnail wp-image-212" src="http://innerwestadv.com/dev/wp-content/uploads/2014/08/Brand-Creation-150x150.png" alt="Brand Creation" width="150" height="150" /></div>
<div class="three-eighths">
<strong>Brand Creation & Management</strong>
The instantaneous brand recognition of a swoosh or a siren all start in the same place. We can build your brand from the ground up, or help to rebrand it.</div>
<div class="one-eighth">
<img class="alignleft size-thumbnail wp-image-213" src="http://innerwestadv.com/dev/wp-content/uploads/2014/08/Market-Media-Research-150x150.png" alt="Market & Media Research" width="150" height="150" /></div>
<div class="three-eighths last">
<strong>Market & Media Research</strong>
You might have the ideas but not the research behind the idea. Let us find out all the information necessary and do the dirty work so you can claim all the glory.</div>
<!-- CODE BREAKS HERE -->
<div class="one-eighth">
<img class="alignleft size-thumbnail wp-image-215" src="http://innerwestadv.com/dev/wp-content/uploads/2014/08/Media-Community-Relations-150x150.png" alt="Media & Community Relations" width="150" height="150" /></div>
<div class="three-eighths">
<strong>Media & Community Relations</strong>
We don’t like revealing our age, but in this case it’s time to brag about it. We are old. So old, if we don’t already know the right person for the story we do the research to find the perfect person who will. Like a good wine, that only gets better with age, the same is true for us.</div>
<div class="one-eighth">
<img class="alignleft size-thumbnail wp-image-219" src="http://innerwestadv.com/dev/wp-content/uploads/2014/08/Web-Design-Development-150x150.png" alt="Web Design & Development" width="150" height="150" /></div>
<div class="three-eighths last">
<strong>Web Design & Development</strong>
Form and Function go hand in hand. There is no point in having a beautifully designed website that isn’t effective, or an effective site that got looks like it was beat with the UGLY stick, if you know what we mean. We seamlessly integrate both form and function to ensure your website is not only visually appealing, but also a highly functioning information center for your business.</div>
<div class="one-eighth">
<img class="alignleft size-thumbnail wp-image-216" src="http://innerwestadv.com/dev/wp-content/uploads/2014/08/Media-Planning-150x150.png" alt="Media Planning" width="150" height="150" /></div>
<div class="three-eighths">
<strong>Media Plannning, Buying & Analysis</strong> (Ipad Wifi Icon)
You wouldn’t dare attempt to build a chair from IKEA without the step-by-step directions. You wouldn’t dream of traveling across Thailand without a map. So why would you spend your hard earned money without a well-developed media strategy? Let us help navigate- We can find your audience, develop cost-efficient strategies to reach them, get your creative to market, and measure the effectiveness of every effort to maximize the impact of each marketing dollar spent.</div>
<div class="one-eighth">
<img class="alignleft size-thumbnail wp-image-220" src="http://innerwestadv.com/dev/wp-content/uploads/2014/08/Web-Hosting-150x150.png" alt="Web Hosting" width="150" height="150" /></div>
<div class="three-eighths last">
<strong>Web Hosting/Management/Maintenance</strong>
We hate the “404 Not Found Error” even more than the tantalizing smell of bacon that wafts into our office at 10am daily from the crepe shop below us. In addition to updates you specifically request, we will also keep an eye on your managed site and address any technical issues as they arise.</div>
<div class="one-eighth">
<img class="alignleft size-thumbnail wp-image-218" src="http://innerwestadv.com/dev/wp-content/uploads/2014/08/Strategic-Planning-150x150.png" alt="Strategic Planning" width="150" height="150" /></div>
<div class="three-eighths">
<strong>Strategic Planning</strong>
We work with you to determine actions, set goals, and then with those goals, we help achieve the actions. We believe with both our connections and resources we can do anything, that’s our strategic plan.</div>
<div class="one-eighth">
<img class="alignleft size-thumbnail wp-image-217" src="http://innerwestadv.com/dev/wp-content/uploads/2014/08/Social-Media-150x150.png" alt="Social Media" width="150" height="150" /></div>
<div class="three-eighths last">
<strong>Social Media</strong>
Sure you know how to work the social platforms, but when running a business do you have time to make sure you’re communicating, building and engaging your audience to turn them into not only fans, but consumers?s</div>
</div>
This worked for me. I tested using firebug
Remove
margin: 0 20px 20px 0;
from
img.alignleft {
float: left;
margin: 0 20px 20px 0;
}
and see the change..all the items will get aranged..Try it out..please..
I want the text labeled
"I want this text aligned with the bottom widget
" to be aligned with bottom widget.
How do I achieve this? HTML ->
<div class="albums">
<iframe class="albumWidget" src="https://widgets.itunes.apple.com/widget.html?c=no&brc=FFFFFF&blc=FFFFFF&trc=FFFFFF&tlc=FFFFFF&d=&t=&m=music&e=album&w=325&h=370&ids=258634938&wt=discovery&partnerId=&affiliate_id=&at=10lumY&ct=" frameborder=0 style="overflow-x:hidden;overflow-y:hidden;width:325px;height: 370px;border:0px; display=inline;"></iframe>
<h3>Only Built 4 Cuban Linx (1995)</h3>
<p>
" Most cd's I buy, I get sick of in a few weeks or even days. However, this album is so perfectly balanced and groundbreaking that I get chills everytime I listen to it. When I listen to it, it just boggles my mind. " -- A customer
</p>
<p>
“ Beats by RZA are sharp like a razor. ” -- A. Sidletsky
</p>
</div>
<div class="albums">
<iframe class="albumWidget" src="https://widgets.itunes.apple.com/widget.html?c=no&brc=FFFFFF&blc=FFFFFF&trc=FFFFFF&tlc=FFFFFF&d=&t=&m=music&e=album&w=325&h=370&ids=328405814&wt=discovery&partnerId=&affiliate_id=&at=10lumY&ct=" frameborder=0 style="overflow-x:hidden;overflow-y:hidden;width:325px;height: 370px;border:0px;"></iframe>
<p>I want this text aligned with the bottom widget</p>
</div>
CSS ->
.albums {
}
iframe.albumWidget {
float:right;
clear: right;
margin-bottom: 20px;
}
Here's a link to website so you can have look http://raekwon.gteaay.com/discs-baby
Here's a link to a screenshot that shows the website the way I need it to be http://raekwon.gteaay.com
i do not know if this can help.. do check my fiddle
http://jsfiddle.net/ayiem999/HFs2k/
.albums {
}
iframe.albumWidget {
float:right;
clear: right;
margin-bottom: 20px;
}
p{
float:right;
clear: right;
margin-bottom: 20px;
}
<div class="albums">
<iframe class="albumWidget" src="https://widgets.itunes.apple.com/widget.html?c=no&brc=FFFFFF&blc=FFFFFF&trc=FFFFFF&tlc=FFFFFF&d=&t=&m=music&e=album&w=325&h=370&ids=258634938&wt=discovery&partnerId=&affiliate_id=&at=10lumY&ct=" frameborder=0 style="overflow-x:hidden;overflow-y:hidden;width:325px;height: 370px;border:0px; display=inline;"></iframe>
<h3>Only Built 4 Cuban Linx (1995)</h3>
<div>
" Most cd's I buy, I get sick of in a few weeks or even days. However, this album is so perfectly balanced and groundbreaking that I get chills everytime I listen to it. When I listen to it, it just boggles my mind. " -- A customer
</div>
<div>
“ Beats by RZA are sharp like a razor. ” -- A. Sidletsky
</div>
</div>
<div class="albums">
<iframe class="albumWidget" src="https://widgets.itunes.apple.com/widget.html?c=no&brc=FFFFFF&blc=FFFFFF&trc=FFFFFF&tlc=FFFFFF&d=&t=&m=music&e=album&w=325&h=370&ids=328405814&wt=discovery&partnerId=&affiliate_id=&at=10lumY&ct=" frameborder=0 style="overflow-x:hidden;overflow-y:hidden;width:325px;height: 370px;border:0px;"></iframe>
<p class="hi">I want this text aligned with the bottom widget</p>
</div>
This works! And it uses class (reusable, write once and apply class where needed), which the correct way to do it.
.albums {
position: absolute;
}
.reviews {
float: left;
height: 50%;
width: 50%;
}
.albumWidget {
height: 50%;
width: 50%;
float: left;
}
<section class="albums">
<section class="reviews">
<h3>Only Built 4 Cuban Linx (1995)</h3>
<p>
" Most cd's I buy, I get sick of in a few weeks or even days. However, this album is so perfectly balanced and groundbreaking that I get chills everytime I listen to it. When I listen to it, it just boggles my mind. " -- A customer
</p>
<p>
“ Beats by RZA are sharp like a razor. ” -- A. Sidletsky
</p>
</section>
<iframe class="albumWidget" src="https://widgets.itunes.apple.com/widget.html?c=no&brc=FFFFFF&blc=FFFFFF&trc=FFFFFF&tlc=FFFFFF&d=&t=&m=music&e=album&w=325&h=370&ids=258634938&wt=discovery&partnerId=&affiliate_id=&at=10lumY&ct=" frameborder=0 style="overflow-x:hidden;overflow-y:hidden;width:325px;height: 370px;border:0px;"></iframe>
<section class="reviews">
<h3>Only Built 4 Cuban Linx II (2009)</h3>
<p>" Raekwon's sound takes listeners back to gritty Shaolin of the 1990s; however, the production does not sound like leftover beats from that era. Instead, it is a fresh, new take on NYC street life and drama. " -- Intellectualista </p>
</section>
<iframe class="albumWidget" src="https://widgets.itunes.apple.com/widget.html?c=no&brc=FFFFFF&blc=FFFFFF&trc=FFFFFF&tlc=FFFFFF&d=&t=&m=music&e=album&w=325&h=370&ids=328405814&wt=discovery&partnerId=&affiliate_id=&at=10lumY&ct=" frameborder=0 style="overflow-x:hidden;overflow-y:hidden;width:325px;height: 370px;border:0px;"></iframe>
</section>
While I was trying to style my footer, and checking it in Firefox, i encountered an error that the facebook, etc icons were not showing up. This is the sample footer html code.
<div id="footer">
<div id="footer_content">
<div id="footer_left">
<!-- JP Morgan && Force For Good Signature -->
<div id="jp_right_content_main">
<div id="jp_right_content_inner1">
<font color="#FFFFFF" size="4" font-family="Times New Roman">In Assocaition with:</font> <br /> <img
class="header-photo" width="280" height="70" alt="JPM Logo"
src="images/Logo_JPM.jpg"></img>
<h1 class="header11">
<font color="#ED872D">Force</font> <font color="white">For</font> <font
color="green">Good</font>
</h1>
</div>
<div id="right_content_inner2">
<img src="images/partner_pic.png" width="130" height="130" />
</div>
</div>
</div>
<div id="footer_right">
<a href="http://www.facebook.com/Unitedwaymumbai" target="_new"><img
src="United%20Way%20Mumbai%20--%20about_us_files/facebook.gif"
height="27" width="16"></a><a
href="http://www.youtube.com/unitedwaymumbai" target="_new"><img
src="United%20Way%20Mumbai%20--%20about_us_files/youtube.gif"
height="27" width="34"></a><a
href="http://www.linkedin.com/company/united-way-of-mumbai"
target="_new"><img
src="United%20Way%20Mumbai%20--%20about_us_files/linkdin.gif"
height="27" width="26"></a><a
href="http://twitter.com/mumbaihelpline" target="_new"><img
src="United%20Way%20Mumbai%20--%20about_us_files/tweeter.gif"
height="27" width="32"></a><br>
<p class="text7">
Copyright United Way Mumbai & J.P.MORGAN SERVICS INDIA PVT LTD. All
Rights Reserved. <a href="sitemap.htm"><span class="text8">Sitemap</span>
</a>Page Designing By <a href="http://www.force4g.com"
target="_blank" class="text8">FORCE FOR GOOD | TEAM : T.U.R.C.S</a>.
</p>
<div id="contact_text" class="header5">Contact: 022-24937676 / 79
or Email: contact#unitedwaymumbai.org</div>
</div>
</div>
</div>
And its corresponding css:
#footer{width:100%; height:auto; border:0px solid black; float:left; background:url('../images/footer_bg.gif') repeat-x;}
#footer_content {width:959px; height:auto; margin-left:auto; margin-right:auto; margin-bottom:30px }
#footer_left {width:491px; float:left; margin-top:16px; margin-bottom:25px; }
#footer_right {width:468px; float:left; margin-top:16px; }
#jp_right_content_main { height:159px; width:468px; float:left; margin:0; padding:0; background-image:url(../images/partner_bg.png); background-repeat:no-repeat}
#jp_right_content_inner1 {width:311px; height:127px; margin-left:27px; float:left; margin-top:5px;}
The facebook, twitter etc png images are not showing up.
Any help would be appericiated.
Regards,
Vivek
And the moral of the story is: Make sure your images are linked correctly.
And for future reference, setting things up on sites like JS fiddle not only helps other people troubleshoot your problem, but gives you a chance to redo what you've already done and catch small errors (like this one).
I'm trying to change my footers margin so that it expands to the width of the webpage, instead it still seems to be affect by the 50px of left/right margin I added to my #content section. What property am I missing here so I can remove the affect of the content's margins on my footer section?
Html
<div id="wrapper" />
<div id="header" />
<div id="mast"><img src="http://i1256.photobucket.com/albums/ii488/terafanb/guildwars2/26.png" height="99" width="774=" /></div>
<div id="below-mast" />
<div id="left" class="column"><img src="http://i157.photobucket.com/albums/t60/Dragon_Aleph/fantasy_warrior_23022-800x600.jpg" height="297" width="226" border="0" alt="Crusader Army" /></div>
<div id="center" class="column"><img src="http://i157.photobucket.com/albums/t60/Dragon_Aleph/fantasy_warrior_23022-800x600.jpg" height="297" width="400" border="0" alt="Crusader Army" /></div>
<div id="right" class="column"><img src="http://i157.photobucket.com/albums/t60/Dragon_Aleph/fantasy_warrior_23022-800x600.jpg" height="297" width="139" border="0" alt="Crusader Army" /></div>
<div></div>
<div id="content" />
<p>
<div class="Heading">Forward Exchange *</div>
$500.00 - collected upon the closing of the Relinquished Property.
$500.00 - collected upon closing of each Replacement Property purchased.
* Special credits may apply - Call Us.<br /></br>
<div id="we-pay">
<br />
<div class="Heading">We pay interest</div>
</br>
We provide full disclosure of the fees involved in the transaction in the Exchange Agreement. Our customers are entitled to receive earned interest based on the First National Bank of Durango Investment Money Market rate, from the time when the Relinquished Property funds are initially deposited. Interest does not accrue on those funds withdrawn during the first 30 calendar days after the funds are deposited in the Exchange Trust Account. Also, interest does not accrue if customer elects to have exchange funds held at First National Bank of Durango in an Unlimited FDIC insurance non-interest bearing account (available through December 31, 2012)
</div>
<br />
<div class="Heading">
Safe-Harbor Reverse Exchange <br />
<h2>We charge the following fees:</h2>
</div>
<div id="prices">$2,500.00 – Title holding fee<br />
$500.00 – LLC fee<br />
$200.00 – Monthly Rent<br />
Plus – Forward Exchange fees<br />
<br />
</div>
<div id="note">
<p>Note: If any improvements need to be made to the parked property,
being held by the EAT ( Exchange Accommodator Titleholder )
there will be an additional fee of 1% of the final sales price to Taxpayer.
</p>
<div>
<br /></br>
<div id="disclaimer">Fees are subject to change without prior notice</p></div>
</div>
<div id="footer">
Home
<strong>l</strong> What is a 1031 Exchange? <strong>l</strong> <a href="exchangeRequ.html">
1031 Exchange Requirements</a> <strong>l</strong> Types of Exchanges <br />
<div id="Second-Half">
How to get Started <strong>l</strong>
Why CLX?<strong>l</strong> Resources <strong>l</strong> FAQs <strong>l</strong> Fees
Contact Us
</div>
</div>
</div>
CSS
*{box-sizing:border-box;}
#wrapper {margin-left:auto; margin-right:auto;width:774px;}
#below-mast { width:774px; overflow:hidden; }
#left {height:297px; width:29%; margin:4px;margin-left:0px;}
#center{height:297px; width:51%; margin:4px;}
#right {height:297px; width:17%; margin:4px;}
#left, #center, #right { float:left;margin-bottom:50px;}
#content{overflow:;margin:0px;margin-top:100px;font-family:Arial, Helvetica, sans-serif;margin-right:50px;margin-left:50px;}
.Heading{font-size:19px;font-weight:bold;text-align:center; text-decoration:underline}
.Heading>h2{font-size:13px;text-decoration:none}
#we-pay{font-size:13px}
#we-pay>.Heading{font-size:20px;text-decoration:none;}
#prices{text-align:center; font-size:20px;}
#note{text-align:center;}
#disclaimer{font-size:13px; text-align:center; font-weight:bold;font-style:italic; }
#footer{margin-right:-50px;margin-left:-50px;}
#footer,a:link{font-family:Helvetica, sans-serif;color:#300000; margin-top:50px;}
#Second-Half{margin-left:auto; margin-right:auto;width:450px;}
Here is a link to my code on Code Pen for your convience
http://codepen.io/Austin-Davis/pen/rLeEi
Your bug can be fixed with the following piece of code:
#footer { margin: 0; position: absolute; left: 0; width: 100%; }
Please checkout: http://codepen.io/joe/pen/uBikf
PS: I gave the footer a gray background for testing purpose.
Sorry guys I was just missing a closing </div> on my #note section making the footer part of the content section, thus making any margin changes to the footer via css useless.
Another solution would be to move the footer outside of the #wrapper div.
Also please check your HTML.. it´s broken in so many places that fixing the css problem might be impossible ;)
eg. you have alot of selfclosing tags "" (not valid)
Also you are missing closing body tag, none exsisting tags "" etc etc..