Image not aligning properly on webpage - html

The image on my webpage is not properly aligned with the video for some reason. It looks like this: This is the image on my webpage
When I try to shift the picture up, it still does not align properly and jsut shifts everything up. How can I properly align the image and the video.
Here is my code so far:
<div class="col-md-9">
<div id="page-1" class= "page one">
<h2 class="heading">Projects</h2>
<div class="resume-wrap d-flex ftco-animate">
<div class="icon d-flex align-items-center justify-content-center">
<span class="flaticon-ideas"></span>
</div>
<div class="text pl-3">
<span class="date">Feb 2020</span>
<h2>CLARITY - NSBE Hacks UofT</h2>
<span class="position"> First place winner and winner of best Google hack</span>
<p> Clarity is a web app catered towards children that struggle with autism. Children with autism have trouble recognising the emotions of other people. Our application listens peoples speech and analyzes the emotions being conveyed in said speech. After the analysis, recommendations are given to the user on how to navigate the situation, in an attempt to make navigating social situations easier. </p>
<img src="/static/images/clarity.png" height = 200px width = 250px>
<video width="300" height="300" controls>
<source src= "/static/video.mp4" type ="video/mp4">
</div>
</div>

Try encapsulating the image and video within their own Bootstrap div. Something like this:
<div class="md-col-6">
<img src="/static/images/clarity.png" height = 200px width = 250px>
</div>
<div class="md-col-6">
<video width="300" height="300" controls>
</div>
This will force the image and video to remain in two columns, and most likely line up with each other. I'd also recommend inspecting the element to see if any padding or margins are causing the misalignment.

Related

Overlapping Div Sections, can't figure out why

I am trying to create a contact section at the bottom of my bootstrap website, with a col-md-3 containing a picture, and col-md-9 beside it carrying the infomation
Except when i make the window smaller the text begins to overlap the picture instead of sitting under or beside it
I have tried making the image responsive, and looking at other ways of keeping it alongside but i cant figure out the issue.
Im sure i am missing something really simple, an would greatly aapprecite any help
I have searched this website for overlapping div issues, and tried a few things but nothing seems to work
<section class="contact bg-grey" id="contact">
<div class="container">
<h2 class="contact-header">Contact Me:</h2>
<div class="row">
<div class="col-sm-3">
<img src="img/me.png" class="responsive" id="bio">
</div>
<div class="col-sm-9" id="contact_details">
<h3 class="contact-header">John Gillespie</h3>
<p>Email: johngillespiexxx#gmail.com</p>
<p>Phone: 07xxxxxxxxx</p>
<p>Twitter: #jxhngillespie</p>
</div>
</div>
</div>
</section>
I was expecting when the page size shrinks that the image would shrink with it, or that the text would stay along side, until the screen becomes too small and then fall underneath. Instead of this happening the text begins to overlap the image
If you add style="max-width: 100%" to the img, it will prevent the image from overflowing outside of its column (the 100% is relative to the width of the column). By default, images always display at their full resolution unless you constrain them in this kind of way.

Place image on top of another image using bootstrap

I have a multiplayer html game (not using canvas) where you have a portrait of your character and a portrait of the character you are playing against. I want to put an image over your opponents character image if they haven't yet loaded their page. The image will say "Not Ready" and when they are ready I'll remove this image.
I'm using bootstrap for positioning of everything though and the answers I've seen before have talked about absolute positioning. How can I position this "Not Ready" image on top of the character portrait displayed with the below code?
My display of character portraits is:
<!--Portraits-->
<div id="divPortraitRow" class="row" style="margin-bottom: 10px;">
<div id="divPlayer" class="col-md-6 text-center">
<img src="#Model.Player.Icon" />
</div>
<div id="divOpponent" class="col-md-6 text-center">
<img src="#Model.Opponent.Icon" />
</div>
</div>
If im not mistaken the character portrait image is <img src="#Model.Player.Icon" />? Then you would want to include the new placeholder image along side your current image (and inside of <div id="divPlayer" class="col-md-6 text-center">) like so:
<div id="divPlayer" class="col-md-6 text-center">
<img src="#Model.Player.Icon" />
<img src="NEW IMAGE" /> <----new image here (order is not important)
</div>
The new image would be set to position: absolute and the parent: <div id="divPlayer" class="col-md-6 text-center"> needs to be set to position: relative otherwise the absolute image becomes relative to the body.
EXAMPLE FIDDLE

resize table height automatically based on image height?

i have been pulling my hair out over this and cant figure it out for days, would REALLY appreciate some help :(
I am using Drupal (and Views) to display a page of images. The Images are laid out using a Grid format. (I am willing to change it from Grid to another format if it will help achieve what i need easier).
What I have is 6 images going across and each image has a set width of 150px, the height of the image is set automatically.
The effect i want to achieve is to have the images sit ON TOP of each other, currently the height of the table the images sit on is all the same and there is a gap under each image, i want the images to site exactly under each other with just maybe 1px apart, similar to how they do it on Tumblr.
The code of how the table and images is printed is below, can someone help me? pleaseeee. From my search i THINK that im unable to do this using Tables. is that correct? If so then how would i do it so that i can keep a similar grid effect so images sit 6 next to each other on each row, and then fit nicely on top of each other ?
Thank you so much
<table id="container" class="views-view-grid cols-6">
<tbody>
<tr class="block">
<td class="col-1 col-first">
<div class="views-field views-field-field-image-pin">
<div class="field-content ptpageimg"><div data-edit-id="node/3643/field_image_pin/und/_custom_views">
<div class="field-item"><div class="domeimageo">
<a href="/members/ptarticle/woolie-003-0">
<img class="pthover" src="/files/styles/150x200/public/images/pinpage/760_w2.jpg?itok=_ux-EGvz" width="150" height="200" alt="" /></a>
<a href="/ptarticle/woolie-003-0" target="_self">
<p class="pttext">Woolie 003
</p>
</a>
</div></div></div></div> </div> </td>
<td class="col-2">
<div class="views-field views-field-field-image-pin">
<div class="field-content ptpageimg"><div data-edit-id="node/3642/field_image_pin/und/_custom_views">
<div class="field-item"><div class="domeimageo">
<img class="pthover" src="/default/files/styles/150x200/public/images/pinpage/tumblr_mohhz9Ce001sor33mo1_1280.jpg?itok=4wFQzr_h" width="150" height="200" alt="" />
<a href="/ptarticle/085" target="_self">
<p class="pttext">085
</p>
</a>
</div></div></div></div>
</div>
</td>
As answered in comments:
Aside from a plugin like isotope.js, elements sitting next to each other will go under no matter how high your row is. Unless using lots of floats and/or absolute positioning, this will happen. By default, a is meant to go under its preceding no matter the height. It's a 's nature.

img alternative text instead of broken image icon

I am sending a html built email body..
Is there a way to display an alternate text while the images are not yet loaded?
I tried overlapping two divs with img and text, it is working but the problem is that the broken-image icon is showing.
<div style="width:100%;min-height:50px!important;text-align:center;background-color:#eee;border-bottom:solid 2px #aaa">
<div style="min-height:10px"> </div>
<div style="min-height:30px">
<div style='width:200px;margin:0 auto;'>
<a href="http://google.com" target="_blank">
<div style='position:relative;'>
<div style='position:absolute; height:30px;width:200px;z-index:1000;'>
<img height="30" width="200" alt="View Presentation" src="http://www.clker.com/cliparts/X/1/Q/v/b/2/green-button.svg">
</div>
<div style='position:absolute;height:30px;width:200px;background-color:#EEE;'>
Click here to view
</div>
</div>
</a>
</div>
</div>
<div style="min-height:10px"> </div>
</div>
Kindly see my work here..
http://jsfiddle.net/msvillanueva/aYuAd/1/
This jQuery plugin can help you
http://www.appelsiini.net/projects/lazyload
Lazy Load is delays loading of images in long web pages. Images outside of viewport are not loaded until user scrolls to them. This is opposite of image preloading.
Using Lazy Load on long web pages will make the page load faster. In some cases it can also help to reduce server load.

embedded YouTube video layout issue

On this page an embedded YouTube video is displayed to the left of a carousel titled "Similar Festivals". The HTML used to embed the YouTube video is:
The HTML of the YouTube section is:
<div class="span4 spacer youtube">
<div class="title clearfix">
<h2 class="pull-left">YouTube</h2>
</div>
<iframe width="1000" height="1000" src="http://www.youtube.com/embed/NI8rQEHoE24"></iframe>
</div>
The layout of the page (using a responsive Bootstrap grid) is such that the video should have the same height as the carousel to the right of it, but as you can see, it is somehow breaking out of its parent container. I want the video to be aligned with the carousel to its right, how can I fix this.
Here's a screenshot in case there's any doubt about what I'm referring to!
I've noticed that row-fluid container is dynamically adding a width of 33% to your Youtube video. So whatever width expectation you set to it is being reset by that class.
Try this:
<div class="row-fluid">
<div class="span4 spacer twitter">
</div>
<!-- Youtube -->
<div class="span4 spacer youtube">
<div class="title clearfix">
<h2 class="pull-left">YouTube</h2>
</div>
<iframe height="150px" src="http://www.youtube.com/embed/NI8rQEHoE24"></iframe>
</div>
<!-- Similar Carousel -->
<div class="span4 spacer">
<div id="similarCarousel" class="carousel slide last">
</div>
</div>
</div>
(hat tip to Mr. Alien)
It sets the iframe height only. The whole row-fluid container expands somewhat, and the height is irregular. However, you don't have the 'jumping outta the container' problem.
Instead of
<iframe id="fitvid811516"
src="Festivals.ie%20_%20Electric%20Picnic%202012_files/NI8rQEHoE24.htm">
</iframe>
Use this
<iframe width="640" height="360"
src="http://www.youtube.com/embed/NI8rQEHoE24?feature=player_detailpage"
frameborder="0" allowfullscreen>
</iframe>
And adjust width and height manually. Iframes don't go along well with dynamic sizing.
Also if you don't want to break the layout but also don't want to change the content within, you can also go to the parent container in HTML and set overflow: hidden
.fluid-width-video-wrapper {
overflow:hidden;
}
Note that this would fix your layout but break the iframe; its bottom parts where play controls stay would be hidden.