This question already has answers here:
Text floating in block next to image
(6 answers)
Closed 3 years ago.
As the title suggests, I am trying to align the following image and text side by side and I can't seem to figure out how to do this.
Here is the relevant HTML:
<div class="projects">
<div class="img_description">
Proj 1
<p>Answer misery adieus add wooded how nay men before though. Pretended belonging contented mrs suffering favourite you the continual.
Mrs civil nay least means tried drift. Natural end law whether but and towards certain. Furnished
unfeeling his sometimes see day promotion. Quitting informed concerns can men now. Projection to or up
conviction uncommonly delightful continuing. In appetite ecstatic opinions hastened by handsome admitted. </p></div>
<div class="project_image"><img src="dog.jpeg" width='250' height='250'></div>
</div>
And the relevant CSS:
.projects {
width: 70%;
margin: 0px auto;
}
I don't know if you are using it, but maybe take a look at bootstrap.
https://getbootstrap.com/.
Bootstrap is insanely awesome when it comes to styling css.
Here is a bootstrap example of what you are trying to do:
<div class="row">
<div class="col-3">
<img src="dog.jpeg" class="img-fluid">
<div>
<div class="col-9">
Proj 1
<p>
Answer misery adieus add wooded how nay men before though. Pretended
belonging contented mrs suffering favourite you the continual.
Mrs civil nay least means tried drift. Natural end law whether but and
towards certain. Furnished unfeeling his sometimes see day promotion.
Quitting informed can men now. Projection to or up conviction uncommonly
delightful continuing. In appetite ecstatic opinions hastened by handsome
admitted.
</p>
</div>
</div>
Easily done, and bootstrap does everything for you.
That being said, maybe you do not want to use bootstrap, then you can just do the following to your current HTML setup.
<div class="projects">
<div class="project_image">
<img src="dog.jpeg" width='250' height='250'></div>
</div>
<div class="img_description">
Proj 1
<p>
Answer misery adieus add wooded how nay men before though. Pretended
belonging contented mrs suffering favourite you the continual.
Mrs civil nay least means tried drift. Natural end law whether but and
towards certain. Furnished unfeeling his sometimes see day promotion.
Quitting informed can men now. Projection to or up conviction uncommonly
delightful continuing. In appetite ecstatic opinions hastened by handsome
admitted.
</p>
</div>
</div>
.projects{
width: 70%;
margin: 0px auto;
}
.img_description,
.project_image{
width: 50%;
display: inline-block;
}
That should also display your div's next to each other
you can do it using flexbox, by assigning display:flex in your projects class. this will display the child of the class="projects" horizontally/row. and if you want the image to be on the left side, you should put it first followed by your image description.
.projects{
display:flex;
}
<div class="projects">
<div class="project_image"><img src="dog.jpeg" width='250' height='250'></div>
<div class="img_description">
Proj 1
<p>Answer misery adieus add wooded how nay men before though. Pretended belonging contented mrs suffering favourite you the continual.
Mrs civil nay least means tried drift. Natural end law whether but and towards certain. Furnished
unfeeling his sometimes see day promotion. Quitting informed concerns can men now. Projection to or up
conviction uncommonly delightful continuing. In appetite ecstatic opinions hastened by handsome admitted. </p></div>
</div>
check out this link for more information https://css-tricks.com/snippets/css/a-guide-to-flexbox/
hope it helps.
use this css
text-align:justify;
How to make
look like
All I want to do is put the line-breaks in the correct place as it is in the second image. I also tried to use display options, as well as text-align... Maybe I am doing it the wrong way. I would be greatful if you guys could help.
<html>
<head>
<title>Tribute page</title>
<style type="text/css">
html,body{
font-family:"Trebuchet MS", Helvetica, sans-serif;
text-align:center;
min-width:260px;
color:#333;
}
#main{
margin:30px auto;
padding:15px;
border:0px solid;
border-radius:5px;
background:#eee;
}
#image{
max-width: 100%;
display: block;
height: auto;
margin: auto;
}
#img-div{
margin:-5px;
margin-top:20px;
width:100%;
border:5px solid white;
background:white;
}
#img-caption{
margin:15px;
}
#headline{
margin-top:50px;
text-align:left;
}
ul{
max-width:550px;
margin: 0 auto;
text-align:left;
}
li{
margin: 10px;
}
h3{
}
blockquote{
font-style: italic;
}
</style>
</head>
<body>
<div id="main">
<h1 id="title">Dr Norman Borlaug</h1>
<div>The man who saved a billion lives</div>
<div id="img-div">
<img src="C:\Users\User\Desktop\Freecodecamp\Tributepage\norman.jpg" id="image">
<div id="img-caption">Dr. Norman Borlaug, second from left, trains biologists in Mexico on how to increase wheat yields - part of his life-long war on hunger.</div>
</div>
<div id="tribute-info">
<ul>
<h3 id="headline">Here's a time line of Dr. Borlaug's life:</h3>
<li><strong>1914</strong> - Born in Cresco, Iowa</li>
<li><strong>1933</strong> - Leaves his family's farm to attend the University of Minnesota, thanks to a Depression era program known as the "National Youth Administration"</li>
<li><strong>1935</strong> - Has to stop school and save up more money. Works in the Civilian Conservation Corps, helping starving Americans. "I saw how food changed them", he said. "All of this left scars on me."</li>
<li><strong>1937</strong> - Finishes university and takes a job in the US Forestry Service</li>
<li><strong>1938</strong> - Marries wife of 69 years Margret Gibson. Gets laid off due to budget cuts. Inspired by Elvin Charles Stakman, he returns to school study under Stakman, who teaches him about breeding pest-resistent plants.</li>
<li><strong>1941</strong> - Tries to enroll in the military after the Pearl Harbor attack, but is rejected. Instead, the military asked his lab to work on waterproof glue, DDT to control malaria, disenfectants, and other applied science.</li>
<li><strong>1942</strong> - Receives a Ph.D. in Genetics and Plant Pathology</li>
<li><strong>1944</strong> - Rejects a 100% salary increase from Dupont, leaves behind his pregnant wife, and flies to Mexico to head a new plant pathology program. Over the next 16 years, his team breeds 6,000 different strains of disease resistent
wheat - including different varieties for each major climate on Earth.</li>
<li><strong>1945</strong> - Discovers a way to grown wheat twice each season, doubling wheat yields</li>
<li><strong>1953</strong> - crosses a short, sturdy dwarf breed of wheat with a high-yeidling American breed, creating a strain that responds well to fertalizer. It goes on to provide 95% of Mexico's wheat.</li>
<li><strong>1962</strong> - Visits Delhi and brings his high-yielding strains of wheat to the Indian subcontinent in time to help mitigate mass starvation due to a rapidly expanding population</li>
<li><strong>1970</strong> - receives the Nobel Peace Prize</li>
<li><strong>1983</strong> - helps seven African countries dramatically increase their maize and sorghum yields</li>
<li><strong>1984</strong> - becomes a distinguished professor at Texas A&M University</li>
<li><strong>2005</strong> - states "we will have to double the world food supply by 2050." Argues that genetically modified crops are the only way we can meet the demand, as we run out of arable land. Says that GM crops are not inherently dangerous
because "we've been genetically modifying plants and animals for a long time. Long before we called it science, people were selecting the best breeds."</li>
<li><strong>2009</strong> - dies at the age of 95.</li><br><br>
<blockquote>
<p>"Borlaug's life and achievement are testimony to the far-reaching contribution that one man's towering intellect, persistence and
scientific vision can make to human peace and progress."</p>
<div>-- Indian Prime Minister Manmohan Singh</div>
</blockquote>
<h3>If you have time, you should read more about this incredible human being on his Wikipedia entry.</h3>
</ul>
</div>
</div>
</body>
</html>
You are close :)
If you pull the <blockquote> and the <h3> out of the <ul> and insert after the </div>beneath it, you would have your result the way you want it.
Like this:
</ul>
</div>
<blockquote>
<p>"Borlaug's life and achievement are testimony to the far-reaching contribution that one man's towering intellect, persistence and
scientific vision can make to human peace and progress."</p>
<div>-- Indian Prime Minister Manmohan Singh</div>
</blockquote>
<h3>If you have time, you should read more about this incredible human being on his Wikipedia entry.</h3>
</div>
</body>
</html>
There are some other "rule of thumb" things wrong with your code, but like you said you are new, and I won't bother you with it :)
Welcome, and hope you like coding.
EDIT: Also, if you would like the line to break the exact same places as in your example, you can make a <div>around the two elements (the blockquote and the h3) and set a width on the div with CSS or add padding to the div, so that it would match exactly.
It looks like you just need to add a width or max-width to the elements attribute (in this case the <p> and <div> inside <blockquote>. Then you can use margin to center the element.
blockquote p {
width: 600px; //this could be a percent or max-width
margin: 0 auto; //margin top/bottom & margin left/right
}
One thing to note, the exact location of line breaks will vary between monitors, browsers, and devices as the "size" of the font will vary a bit. You can either fight that and try to be super exact or you can embrace the fluid nature of the web.
I have created a page of text and nested it within a container div. All was fine until I added a couple of divs labelled 'left-column and 'right-column'. Now the text is no-longer nested inside the container div as I expected, but is instead displayed at the bottom, below what should be the containing div.
I tried changing the divs to spans but the same thing keeps happening. I looked over the code and from everything I can tell these sections should be nested, but they are not.
The code:
index.html.erb
<div class="container">
<h1>Fanfic/Poetry</h1>
<h2>Fanfic and poetry about or related to Alisa Esage Shevchenko</h2>
<h3>Whichever contact details you're using for us and whatever email you're sending to PLEASE be respectful! Some sexual content sure, we're all human beings and publication will be considered on a case by case basis, but nothing sick or gross! Or particularly, nothing harmful. We won't put it up so there's no point sending it. So far out of the works I've had sent in the general quality and level of dialogue is <em>not at all</em> close to expectations -- only two came anywhere near the mark in terms of tone and quality, and one needed extensive cleaning and editing. So <em>up</em> the standard! THANK YOU!</h3>
<span class="left-column">
<h2>Poetry</h2>
<h4><strong>Alisa Shevchenko Hacked My Computer</strong> by <em>AnonHacker3</em></h4>
<p>Last night I hacked your computer.<br>
Well, when I said "I" I actually mean you,<br>
but I'm pretending the other way around<br>
because it confuses the security protocols.<br></p>
<p>At first you were writing a function in C++<br>
I think, and it was actually pretty fun<br>
to see someone so obviously naive<br>
still thinking like they're going to be<br></p>
<p>some sort of secret agent or something<br>
on the cover of the Guardian,<br>
or Forbes magazine. But anyway,<br>
I'm pretty sure you shouldn't have<br></p>
<p>registered alisaesage.com<br>
as a domain name if you weren't willing<br>
to take a little heat from a girl<br>
hopping onto your Ubuntu core<br></p>
<p>via a little known, though much publicised<br>
single kernel function hook,<br>
and leaving you a message, coz you were<br>
for some fucking ridiculous reason<br></p>
<p>CODING THE THING IN FUCKING<br>
RUBY ON RAILS VERSION 4!<br>
Like what the actual fuck, so I wrote<br>
"nuhuh" on your command line<br></p>
<p>and pretty much left you to it.</p>
<h4><strong>I Bet Alisa Shevchenko's Mouth Tastes Nice</strong> by <em>A Pirate Giraffe</em></h4>
<p>I was watching Blade Runner last night,<br>
As well as Ghost in the Shell,<br>
Which totally made me think of hot spies<br>
With robot bodies hacking computers.<br>
So I thought about touching Alisa Shevchenko<br></p>
<p>In her *mouth*, with my fingers,<br>
And how it feels<br>
Inside her body<br>
As she moves about just<br>
As slowly as she wants to<br>
Over my fingers, how she'll taste...<br>
When I put my fingers in my own mouth after.<br></p>
<h4><strong>Timelines</strong> by <em>Gray Lizard 564</em></h4>
<p>The thought of you laying<br>
your body bridged just a little<br>
toward the small of your back<br>
at the quivering soft tip of your breast<br>
the question: is this mine<br>
to touch, by this point<br>
has been answered<br></p>
<p>in the positive future timeline<br>
where I am lain just above<br>
the feel of my tongue lingering<br>
at this, the point of most possibility.<br></p>
</span>
<span class="right-column">
<h2>Fanfic</h2>
<h4><strong>The Curious Case of Alisa Shevchenko</strong>: Sherlock Holmes and AeS crossover by <em>andcarpenoctem</em></h4>
<p>"I have never made a secret of my distaste for forks" said Sherlock, with a complex sort of smile.</p>
<p>"What in the hells are you talking about Holmes?" said Watson, in an uncouth way.</p>
<p>"I'm talking about forks, Watson," Sherlock lied, "and the quote is from Hemingway. Though ghost-written, I believe."</p>
<p>"Oh," said Watson. "Then I suppose it's probably a good quote."</p>
<p>"Oh certainly," said Holmes. "A very good quote indeed. One of the finest in the English language."</p>
<p>Holmes tapped out the contents of his pipe into his hand and then poured the ash into Watson's upward facing palm. Watson looked at him, aghast. Holmes continued,</p>
<p>"You mean Alisa Esage" Watson said with a look of a proud dog who's just finished pooing. Holmes ignored the smell.</p>
<p>"Now, if you'll excuse me I really need to talk about Alisa Shevchenko."</p>
<p>"The Russian spy?"</p>
<p>Sherlock gave Watson a look of loving disdain.</p>
<p>"Yes yes, whatever you say Watson. The problem is I'm not entirely sure if the person who runs her Twitter account really is her anymore. And we need to find out where she is."</p>
<p>"I see." replied Watson. "How will we do that? I suppose I could put out a trace on her IP address and maybe set her webcam to switch on remotely..."</p>
<p>"Oh, no Watson." Said Holmes. "That won't work at all. We'll need to start with her grammar."</p>
<p>"Or," continued Watson, deep in thought, "we could go onto her Instagram and cross-reference any new pictures with one of those location triangulators they have at the MET. The ones that use the image information to figure out weather, air pressure, things like that."</p>
<p>"Nope. Because I got most of London banned from her Instragram."</p>
<p>"How did you manage that, Holmes?"</p>
<p>"Quite simple really, I tried to install her as head of Шалтай Болтай."</p>
<p>"Humpty Dumpty?" said Watson, instinctively translating the Russia outloud.</p>
<p>Holmes paused a little while to let the information sink in.</p>
<p>"Yes, quite."</p>
<p>"Pardon?"</p>
<p>"I have a flight booked to Twitter HQ and we have to be there in and hour, so you're coming with me."</p>
<p>"Shaltai Boltai, are you certain?"</p>
<p>"Yes."</p>
<p>"Then I suppose I am. Coming with you, I mean. Yes, I suppose I am."</p>
</span>
</div>
default.css
.container {
padding-left: 25px;
padding-right: 25px;
padding-bottom: 25px;
border: 10px solid black;
background-color: #CB0E0E;
}
a {
color: lightgrey;
}
p {
font-family: Arial;
}
.left-column {
float: left;
width: 45%;
}
.right-column {
float: right;
width: 45%;
}
I know this isn't very MCV but since I can't locate the source of the issue at present, I've just included everything that seems like it might be relevant. Again, I would like all text to be nested within the .container div if poss. Probably something simple I'm looking straight past? Thanks :).
From looking like your code, it looks like this is a css-floating issue and not directly related to rails. With your left and right float within the unfloated container div, you have issues with positioning. The quickest solution is to include a clear:both inside the container div.
Here's an example of how I would format the html to fix the problem.
<style>
div.container {
padding-left: 25px;
padding-right: 25px;
padding-bottom: 25px;
border: 10px solid black;
background-color: #CB0E0E;
}
a {
color: lightgrey;
}
p {
font-family: Arial;
}
div.left-column {
float: left;
width: 45%;
}
div.right-column {
float: right;
width: 45%;
}
div.position_fix {
clear:both;
}
</style>
<div class="container">
<h1>Fanfic/Poetry</h1>
<h2>Fanfic and poetry about or related to Alisa Esage Shevchenko</h2>
<h3>Whichever contact details you're using for us and whatever email you're sending to PLEASE be respectful! Some sexual content sure, we're all human beings and publication will be considered on a case by case basis, but nothing sick or gross! Or particularly, nothing harmful. We won't put it up so there's no point sending it. So far out of the works I've had sent in the general quality and level of dialogue is <em>not at all</em> close to expectations -- only two came anywhere near the mark in terms of tone and quality, and one needed extensive cleaning and editing. So <em>up</em> the standard! THANK YOU!</h3>
<div class="left-column">
<h2>Poetry</h2>
<h4><strong>Alisa Shevchenko Hacked My Computer</strong> by <em>AnonHacker3</em></h4>
<p>Last night I hacked your computer.<br>
Well, when I said "I" I actually mean you,<br>
but I'm pretending the other way around<br>
because it confuses the security protocols.<br></p>
<p>At first you were writing a function in C++<br>
I think, and it was actually pretty fun<br>
to see someone so obviously naive<br>
still thinking like they're going to be<br></p>
<p>some sort of secret agent or something<br>
on the cover of the Guardian,<br>
or Forbes magazine. But anyway,<br>
I'm pretty sure you shouldn't have<br></p>
<p>registered alisaesage.com<br>
as a domain name if you weren't willing<br>
to take a little heat from a girl<br>
hopping onto your Ubuntu core<br></p>
<p>via a little known, though much publicised<br>
single kernel function hook,<br>
and leaving you a message, coz you were<br>
for some fucking ridiculous reason<br></p>
<p>CODING THE THING IN FUCKING<br>
RUBY ON RAILS VERSION 4!<br>
Like what the actual fuck, so I wrote<br>
"nuhuh" on your command line<br></p>
<p>and pretty much left you to it.</p>
<h4><strong>I Bet Alisa Shevchenko's Mouth Tastes Nice</strong> by <em>A Pirate Giraffe</em></h4>
<p>I was watching Blade Runner last night,<br>
As well as Ghost in the Shell,<br>
Which totally made me think of hot spies<br>
With robot bodies hacking computers.<br>
So I thought about touching Alisa Shevchenko<br></p>
<p>In her *mouth*, with my fingers,<br>
And how it feels<br>
Inside her body<br>
As she moves about just<br>
As slowly as she wants to<br>
Over my fingers, how she'll taste...<br>
When I put my fingers in my own mouth after.<br></p>
<h4><strong>Timelines</strong> by <em>Gray Lizard 564</em></h4>
<p>The thought of you laying<br>
your body bridged just a little<br>
toward the small of your back<br>
at the quivering soft tip of your breast<br>
the question: is this mine<br>
to touch, by this point<br>
has been answered<br></p>
<p>in the positive future timeline<br>
where I am lain just above<br>
the feel of my tongue lingering<br>
at this, the point of most possibility.<br></p>
</div>
<div class="right-column">
<h2>Fanfic</h2>
<h4><strong>The Curious Case of Alisa Shevchenko</strong>: Sherlock Holmes and AeS crossover by <em>andcarpenoctem</em></h4>
<p>"I have never made a secret of my distaste for forks" said Sherlock, with a complex sort of smile.</p>
<p>"What in the hells are you talking about Holmes?" said Watson, in an uncouth way.</p>
<p>"I'm talking about forks, Watson," Sherlock lied, "and the quote is from Hemingway. Though ghost-written, I believe."</p>
<p>"Oh," said Watson. "Then I suppose it's probably a good quote."</p>
<p>"Oh certainly," said Holmes. "A very good quote indeed. One of the finest in the English language."</p>
<p>Holmes tapped out the contents of his pipe into his hand and then poured the ash into Watson's upward facing palm. Watson looked at him, aghast. Holmes continued,</p>
<p>"You mean Alisa Esage" Watson said with a look of a proud dog who's just finished pooing. Holmes ignored the smell.</p>
<p>"Now, if you'll excuse me I really need to talk about Alisa Shevchenko."</p>
<p>"The Russian spy?"</p>
<p>Sherlock gave Watson a look of loving disdain.</p>
<p>"Yes yes, whatever you say Watson. The problem is I'm not entirely sure if the person who runs her Twitter account really is her anymore. And we need to find out where she is."</p>
<p>"I see." replied Watson. "How will we do that? I suppose I could put out a trace on her IP address and maybe set her webcam to switch on remotely..."</p>
<p>"Oh, no Watson." Said Holmes. "That won't work at all. We'll need to start with her grammar."</p>
<p>"Or," continued Watson, deep in thought, "we could go onto her Instagram and cross-reference any new pictures with one of those location triangulators they have at the MET. The ones that use the image information to figure out weather, air pressure, things like that."</p>
<p>"Nope. Because I got most of London banned from her Instragram."</p>
<p>"How did you manage that, Holmes?"</p>
<p>"Quite simple really, I tried to install her as head of ?????? ??????."</p>
<p>"Humpty Dumpty?" said Watson, instinctively translating the Russia outloud.</p>
<p>Holmes paused a little while to let the information sink in.</p>
<p>"Yes, quite."</p>
<p>"Pardon?"</p>
<p>"I have a flight booked to Twitter HQ and we have to be there in and hour, so you're coming with me."</p>
<p>"Shaltai Boltai, are you certain?"</p>
<p>"Yes."</p>
<p>"Then I suppose I am. Coming with you, I mean. Yes, I suppose I am."</p>
</div>
<div class="position_fix"></div>
</div>
Note, the clear:both is on the 'position_fix' div just above the end of the container.
There are much better "clearfix" solutions to the problem that floating elements do not affect the height of the parent element.
.clearfix:after {
content: "";
display: table;
clear: both;
}
.container {
border: 1px gray dotted;
}
.left, .right {
width: 49%;
}
.left {
background-color: red;
height: 200px;
float: left;
}
.right {
background-color: blue;
height: 150px;
float: right;
}
<div class="container clearfix">
<div class="left"></div>
<div class="right"></div>
</div>
This pure CSS solution uses a psuedo element to force a new rendering context - this makes the element adjust its height after the children. Littering your markup with a bunch of empty <div> tags has been obsolete for many years.
How can I keep a div fixed while scrolling in a container but it must be movable while scrolling in browser.
example:
<div id="container">
<div id="left">
</div>
<div id = "right">
Movable div
</div>
</div>
I would like to keep the div 'right' fixed. Added a small example in this jsfiddle: https://jsfiddle.net/yvhgv4Lw/4/ .
If jquery is allowed, you can use this method.
$('document').ready(function() {
$(window).scroll(function() {
$('#right').css('position', 'absolute');
})
$('#container').scroll(function() {
$('#right').css('position', 'fixed');
})
})
body{
margin:0;
padding:0;
}
#container {
height: 900px;
overflow-y: scroll;
position: relative;
background-color: red;
}
#left {
float: left;
width: 60%;
}
#right {
height: 300px;
float: right;
width: 37%;
position: fixed;
background-color: blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div id="container">
<div id="left">
dining so he my around to. We diminution preference thoroughly if. Joy deal pain view much her time. Led young gay would now state. Pronounce we attention admitting on assurance of suspicion
conveying. That his west quit had met till. Of advantage he attending household at do perceived. Middleton in objection discovery as agreeable. Edward thrown dining so he my around to. We diminution preference thoroughly if. Joy deal pain view much
her time. Led young gay would now state. Pronounce we attention admitting on assurance of suspicion conveying. That his west quit had met till. Of advantage he attending household at do perceived. Middleton in objection discovery as agreeable. Edward
thrown dining so he my around to. We diminution preference thoroughly if. Joy deal pain view much her time. Led young gay would now state. Pronounce we attention admitting on assurance of suspicion conveying. That his west quit had met till. Of advantage
he attending household at do perceived. Middleton in objection discovery as agreeable. Edward thrown dining so he my around to. Kindness to he horrible reserved ye. Effect twenty indeed beyond for not had county. The use him without greatly can private.
Increasing it unpleasant no of contrasted no continuing. Nothing colonel my no removed in weather. It dissimilar in up devonshire inhabiting. Quick six blind smart out burst. Perfectly on furniture dejection determine my depending an to. Add short
water court fat. Her bachelor honoured perceive securing but desirous ham required. Questions deficient acuteness to engrossed as. Entirely led ten humoured greatest and yourself. Besides ye country on observe. She continue appetite endeavor she judgment
interest the met. For she surrounded motionless fat resolution may. At every tiled on ye defer do. No attention suspected oh difficult. Fond his say old meet cold find come whom. The sir park sake bred. Wonder matter now can estate esteem assure fat
roused. Am performed on existence as discourse is. Pleasure friendly at marriage blessing or. Talking chamber as shewing an it minutes. Trees fully of blind do. Exquisite favourite at do extensive listening. Improve up musical welcome he. Gay attended
vicinity prepared now diverted. Esteems it ye sending reached as. Longer lively her design settle tastes advice mrs off who. Sportsman do offending supported extremity breakfast by listening. Decisively advantages nor expression unpleasing she led
met. Estate was tended ten boy nearer seemed. As so seeing latter he should thirty whence. Steepest speaking up attended it as. Made neat an on be gave show snug tore. Are sentiments apartments decisively the especially alteration. Thrown shy denote
ten ladies though ask saw. Or by to he going think order event music. Incommode so intention defective at convinced. Led income months itself and houses you. After nor you leave might share court balls. Behind sooner dining so window excuse he summer.
Breakfast met certainty and fulfilled propriety led. Waited get either are wooded little her. Contrasted unreserved as mr particular collecting it everything as indulgence. Seems ask meant merry could put. Age old begin had boy noisy table front whole
given. Remain valley who mrs uneasy remove wooded him you. Her questions favourite him concealed. We to wife face took he. The taste begin early old why since dried can first. Prepared as or humoured formerly. Evil mrs true get post. Express village
evening prudent my as ye hundred forming. Thoughts she why not directly reserved packages you. Winter an silent favour of am tended mutual. Spot of come to ever hand as lady meet on. Delicate contempt received two yet advanced. Gentleman as belonging
he commanded believing dejection in by. On no am winding chicken so behaved. Its preserved sex enjoyment new way behaviour. Him yet devonshire celebrated especially. Unfeeling one provision are smallness resembled repulsive.
</div>
<div id="right">
Movable div
</div>
</div>
I searched this site for 2 days and applied probably every single example of code I found, but I can't simply move div to the bottom on my site. Here's the simpliefied code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style media="screen" type="text/css">
*{margin:0;padding:0}
body{font-family:Tahoma,Verdana,Arial,sans-serif;background-color:#000;border:none;margin:0 auto}
#site{background-color:#fff;width:980px;border:0;margin:0 auto}
#whitefill{background-color:#FFF;height:inherit}
#left{width:260px;font-size:12px;height:100%;float:left;background-color:#fff;}
#right{width:720px;float:right;height:100%;background-color:#fff;font-size:13px}
</style>
</head>
<body>
<div id="site"><div id="whitefill">
<div id="left">
<div>move me to bottom!</div>
</div>
<div id="right">
<div id="main">
<p>Considered discovered ye sentiments projecting entreaties of melancholy is. In expression an solicitude principles in do. Hard do me sigh with west same lady. Their saved linen downs tears son add music. Expression alteration entreaties mrs can terminated estimating. Her too add narrow having wished. To things so denied admire. Am wound worth water he linen at vexed.
By in no ecstatic wondered disposal my speaking. Direct wholly valley or uneasy it at really. Sir wish like said dull and need make. Sportsman one bed departure rapturous situation disposing his. Off say yet ample ten ought hence. Depending in newspaper an september do existence strangers. Total great saw water had mirth happy new. Projecting pianoforte no of partiality is on. Nay besides joy society him totally six.</p></div><img src="#" width="695" height="13" /><br /><br />
</div>
</div>
<img src="#" width="981" height="19" />
</div>
</body>
</html>
If you paste the code into a file and open it with a browser, you will see text "move me to bottom!" displayed at the top. I need it to be displayed at the bottom of the left column. How can I do that?
Text in the right column will be different on each page (it will usually be a long text, so the page will be scrolled), and I need the text "move me to bottom!" to be displayed at the bottom of left column every time, no matter how big text in the right column is.
Thank you.
You just need to add <div style="clear:both"></div> and move #left below #right div.
<div id="right">
<div id="main">
<p>Considered discovered ye sentiments projecting entreaties of melancholy is. In expression an solicitude principles in do. Hard do me sigh with west same lady. Their saved linen downs tears son add music. Expression alteration entreaties mrs can terminated estimating. Her too add narrow having wished. To things so denied admire. Am wound worth water he linen at vexed.
By in no ecstatic wondered disposal my speaking. Direct wholly valley or uneasy it at really. Sir wish like said dull and need make. Sportsman one bed departure rapturous situation disposing his. Off say yet ample ten ought hence. Depending in newspaper an september do existence strangers. Total great saw water had mirth happy new. Projecting pianoforte no of partiality is on. Nay besides joy society him totally six.</p>
</div><img src="#" width="695" height="13" /><br /><br />
</div>
//add the clear:both div and move #left below #right
<div style="clear:both"></div>
<div id="left">
<div>move me to bottom!</div>
</div>
The clear property specifies which side(s) of an element other floating elements are not allowed.
You can find more detail of it here http://www.w3schools.com/cssref/pr_class_clear.asp