Float text to the right of figure and figcaption - css

I discovered the "figure" and "figcaption" elements today. How do I wrap text next (right) to the image and caption.
<div>
<img alt="Hannibal Regional Medical Building" src="https://hannibalregionalmedicalgroup.org/Portals/0/locations/hannibal_regional_medical_building_375.jpg" width="375" height="178" style="text-align: left;" />
<figcaption>Hannibal Regional Medical Building</figcaption>
</div>
<div>
<p>
<span>Hannibal Regional Medical Group
<br />
6500 Hos​pital Drive<br />
Hannibal, MO 63401
</span>
</p>
</div>
<div>
<p><span>To make an appointment,<br />
please call 573-629-3500
</span>
</p>
</div>

Replace the first div with figure (only this is valid) and then put float:left; on the figure:
<figure style="float:left;">
<img alt="Hannibal Regional Medical Building" src="https://hannibalregionalmedicalgroup.org/Portals/0/locations/hannibal_regional_medical_building_375.jpg" width="375" height="178"/>
<figcaption>Hannibal Regional Medical Building</figcaption>
</figure>
<div>
<p>
<span>Hannibal Regional Medical Group<br/>
6500 Hos​pital Drive<br/>
Hannibal, MO 63401</span>
</p>
</div>
<div>
<p>
<span>To make an appointment,<br/>
please call 573-XXX-XXXX</span>
</p>
</div>

The HTML <figcaption> element represents a caption or a legend
associated with a figure or an illustration described by the rest of
the data of the <figure> element which is its immediate ancestor.
Permitted parents: A <figure> element; the <figcaption> element
must be its first or last child. -MDN
That means using a <div> tag as the immediate ancestor for a <figcaption> is invalid HTML in your example. To fix that you need to replace the <div> with <figure>.
<figure>
<img src="" alt="">
<figcaption>...</figcaption>
</figure>
And to make the rest of text to display on the right hand, there are many options, such as using float is the most common way.
figure {
float: left;
}

<figure style="float:left;">
<img alt="Hannibal Regional Medical Building" src="https://hannibalregionalmedicalgroup.org/Portals/0/locations/hannibal_regional_medical_building_375.jpg" width="375" height="178" />
<figcaption>Hannibal Regional Medical Building</figcaption>
</figure>
Demo:
http://jsfiddle.net/tuga/6va2nqad/3/

Related

Modal stays on screen or Does not appear when clicking <a> element

<div class="lotion-container">
<div class="lotion-sub">
<img src="images/item1.png" alt="">
<h5>THE RITUAL OF SAKURA</h5>
<h4>Cherry Blossom Hand Lotion</h4>
<p>Body lotion, 70ml</p>
<p>$12.50</p>
ADD TO BAG
</div>
<div class="lotion-sub">
<img src="images/item2.png" alt="">
<h5>THE RITUAL OF AYURVEDA</h5>
<h4>Himalaya Honey body cream</h4>
<p>Body lotion, 70ml</p>
<p>$7.50</p>
ADD TO BAG
</div>
<div class="lotion-sub">
<img src="images/item3.png" alt="">
<h5>THE RITUAL OF SAKURA</h5>
<h4>Organic rice miilk body cream</h4>
<p>Body lotion, 70ml</p>
<p>$7.50</p>
ADD TO BAG
</div>
<div id="lotion1" class="L1">
<div class="info1">
<h4>IT'S IN THE BAG!</h4>
<hr>
<img src="images/item1.png" alt="">
<h5>The RITUAL OF SAKURA</h5>
<h3>Cherry Blosson Hand Lotion</h3>
<p>Body lotion, 70ml</p>
<h5>$12.50</h5>
<br>
<p>Mix & Match 3/$33</p>
<p>Nurture and comfort skin from top to toe with The Ritual of Sakura Body Cream from
Rituals.</p>
<hr>
CONTINUE SHOPPING
X
</div>
</div>
So I'm trying to make a popup modal the issue arises when I go to CSS and try and change the opacity and make the modal context only appear when the user presses the add to bag link so can anyone give me advice or a helping hand on where I went wrong on the code.
Using CSS create a modal that pops up when person wants to click on add to bag.

Responsive grid of md-cards with different height via angular material

Here is my md-card's loop (except the first div):
<div layout="column" layout-gt-sm="row" layout-wrap="">
<div flex="25" flex-gt-sm="50">
<md-card>
<md-card-header>
<md-card-avatar><img src="#" />
</md-card-avatar>
<md-card-header-text>
<span class="md-title">Angular</span>
<span class="md-subhead">Material</span>
</md-card-header-text>
</md-card-header>
<img ng-src="{{imagePath}}" alt="Washed Out" class="md-card-image" />
<md-card-title>
<md-card-title-text>
<span class="md-headline">Text</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<p>
Content
</p>
</md-card-content>
<md-button>Button</md-button>
</md-card>
</div>
<!-- another card -->
</div>
This works fine, here is the picture.
But what if i don't want to display cards strictly on the lines? Is there any way to get something like
this?
That kind of layout will require you to use some javascript to add to the view logic. Since each of your cards are using rows, it would not be currently possible to do that styling.
I would check out http://masonry.desandro.com/

Header tag Background Color extending into Columns on iPad

I am working on a website and am having problems with the CSS on the IPAD (and possibly the iPhone).
Basically on the Sponsors page: http://www.tcsdesignreno.com/fsw/?page_id=1149. I am getting a red background behind the different sections. I think it has to do with the H3 tags that have a red background.
The same thing happens here: http://www.tcsdesignreno.com/fsw/?page_id=1165. They both are using the Easy Columns plugin in Wordpress.
Here is some sample HTML
<h3 class="sponsor-hdr" style="text-align: center;">Advertising and Media Partners</h3>
<div class="ezcol ezcol-one-third">
<p><a title="Fire Rescue 1" href="http://www.firerescue1.com/" target="_blank"><img class=" size-full wp-image-1238 aligncenter" src="http://www.tcsdesignreno.com/fsw/wp-content/uploads/2014/12/161_FR1_FC_Logo_Stacked.jpg" alt="FireRescue1.com, Fire Chief" width="161" height="93" /></a></p>
</div>
<div class="ezcol ezcol-two-third ezcol-last">
<p><strong>FireRescue1 / Fire Chief</strong><br />
200 Green St.<br />
2nd Floor<br />
San Francisco, CA 94111<br />
Phone: 415-962-5912</p>
</div><div class="ezcol-divider"></div>
<div class="ezcol ezcol-one-third">
<p><a title="CSFA" href="http://www.csfa.net/" target="_blank"><img class=" size-full wp-image-1233 aligncenter" src="http://www.tcsdesignreno.com/fsw/wp-content/uploads/2014/12/116_LatestCSFA-3_5_x_2_75_Logo.jpg" alt="California State Firefighters' Assn " width="116" height="91" /></a></p>
</div>
<div class="ezcol ezcol-two-third ezcol-last">
<p><strong>California State Firefighters’ Assn </strong><br />
2701 K Street, Suite 201<br />
Sacramento, CA 95816<br />
Phone: 800-451-2732<br />
Fax: 916-446-9889</p>
</div><div class="ezcol-divider"></div>
<h3 class="sponsor-hdr" style="text-align: center;">Program Sponsors</h3>
<div class="ezcol ezcol-one-third"><a title="FPAN" href="http://www.fpanevada.org/" target="_blank"><img class="aligncenter size-full wp-image-1232" src="http://www.tcsdesignreno.com/fsw/wp-content/uploads/2014/12/116_FPAN_Logo_Color.jpg" alt="FPAN" width="116" height="116" /></a></div>
<div class="ezcol ezcol-two-third ezcol-last">
<p>In appreciation to:<br />
<strong>Fire Prevention Association of Nevada</strong><br />
<strong>National Code Services Association</strong></p>
</div><div class="ezcol-divider"></div>
<h3 class="sponsor-hdr" style="text-align: center;">Tote Bag Sponsors</h3>
<div class="ezcol ezcol-one-third"><a title="Burton's Fire" href="http://www.burtonsfire.com/" target="_blank"><img class="aligncenter size-full wp-image-1236" src="http://www.tcsdesignreno.com/fsw/wp-content/uploads/2014/12/158_BURTONS_FIRE_INC_LOGO.jpg" alt="BURTONS FIRE" width="158" height="54" /></a></p>
</div>
<div class="ezcol ezcol-two-third ezcol-last">
<p><strong>Burton’s Fire</strong><br />
1301 Doker Avenue<br />
Modesto, CA 95351<br />
209-544-3161</p>
</div><div class="ezcol-divider"></div>
<div class="ezcol ezcol-one-third"><a title="Waterous" href="http://www.waterousco.com/" target="_blank"><img class="aligncenter size-full wp-image-1237" src="http://www.tcsdesignreno.com/fsw/wp-content/uploads/2014/12/158_WaterousLogoSm.jpg" alt="Waterous" width="155" height="29" /></a></p>
</div>
CSS:
h3 {
background-color: #990000;
color: #ffffff;
padding: 10px 0;
text-align: center;
width: 100%;
max-height:92px;
}
Here is an image:
Can anyone see why these sections are showing up in red? For the life of me I can't seem to figure it out.
Looks like your floats aren't clearing. You can add this to your current styles:
.singlepost .content-entry h3 {
clear: both;
}

Why aren't my floats lining up?

I've been staring at this problem for awhile now, and I was hoping someone on here could steer me in the right direction
For some reason I can't get my floats to line up the way i want them to! I managed to get the movie to the right, but when I want the two floated columns of reviewer's quotes to be up there right next to it.
Here's my CSS Code that deals with the picture and the columns
.overview { /* The picture */
display:block;
float:right;
background-color: #A2B964;
}
.column1{
clear: left;
width: 31%;
margin-left: 2%;
margin-right: 1%;
}
.column2{
clear: left;
width: 31%;
margin-left: 1%;
margin-right: 2%;
}
Here is the HTML for the picture:
<div class = "overview">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/overview.png" alt="general overview" />
</div>
And the HTML for the columns:
<div class = "column1">
<p class = "quotebox">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/rotten.gif" alt="Rotten" style="float:left;padding:5px;"/>
<q>Ditching the cheeky, self-aware wink that helped to excuse the concept's inherent corniness, the movie attempts to look polished and 'cool,' but the been-there animation can't compete with the then-cutting-edge puppetry of the 1990 live-action movie.</q>
</p>
<p class = "reviewer">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/critic.gif" alt="Critic" style="float:left;padding:5px;"/>
Peter Debruge <br />
<em>Variety</em>
</p>
<p class = "quotebox">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/fresh.gif" alt="Fresh" style="float:left;padding:5px;"/>
<q>TMNT is a fun, action-filled adventure that will satisfy longtime fans and generate a legion of new ones.</q>
</p>
<p class = "reviewer">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/critic.gif" alt="Critic" style="float:left;padding:5px;"/>
Todd Gilchrist <br />
<em>IGN Movies</em>
</p>
<p class = "quotebox">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/rotten.gif" alt="Rotten" style="float:left;padding:5px;"/>
<q>It stinks!</q>
<br />
</p>
<p class = "reviewer">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/critic.gif" alt="Critic" style="float:left;padding:5px;"/>
Jay Sherman (unemployed)
</p>
<p class = "quotebox">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/rotten.gif" alt="Rotten" style="float:left; padding:5px;"/>
<q>The rubber suits are gone and they've been redone with fancy computer technology, but that hasn't stopped them from becoming dull.</q>
</p>
<p class = "reviewer">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/critic.gif" alt="Critic" style="float:left;padding:5px;"/>
Joshua Tyler <br />
<em>CinemaBlend.com</em>
</p>
<p class = "quotebox">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/rotten.gif" alt="Rotten" style="float:left;padding:5px;"/>
<q>YOUR REVIEW HERE</q>
</p>
<p class = "reviewer">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/critic.gif" alt="Critic" style="float:left;padding:5px;"/>
NAME <br />
<em>PUBLICATION</em>
</p>
</div>
<div class = "column2">
<p class = "quotebox">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/rotten.gif" alt="Rotten" style="float:left;padding:5px;"/>
<q>The turtles themselves may look prettier, but are no smarter; torn irreparably from their countercultural roots, our superheroes on the half shell have been firmly co-opted by the industry their creators once sought to spoof.</q>
</p>
<p class = "reviewer">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/critic.gif" alt="Critic" style="float:left;padding:5px;"/>
Jeannette Catsoulis <br />
<em>New York Times</em>
</p>
<p class = "quotebox">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/rotten.gif" alt="Rotten" style="float:left;padding:5px;"/>
<q>Impersonally animated and arbitrarily plotted, the story appears to have been made up as the filmmakers went along.</q>
</p>
<p class = "reviewer">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/critic.gif" alt="Critic" style="float:left;padding:5px;"/>
Ed Gonzalez <br />
<em>Slant Magazine</em>
</p>
<p class = "quotebox">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/fresh.gif" alt="Fresh" style="float:left;padding:5px;"/>
<q>The striking use of image and motion allows each sequence to leave an impression. It's an accomplished restart to this franchise.</q>
</p>
<p class = "reviewer">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/critic.gif" alt="Critic" style="float:left;padding:5px;"/>
Mark Palermo <br />
<em>Coast (Halifax, Nova Scotia)</em>
</p>
<p class = "quotebox">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/rotten.gif" alt="Rotten" style="float:left;padding:5px;"/>
<q>The script feels like it was computer generated. This mechanical presentation lacks the cheesy charm of the three live action films.</q>
</p>
<p class = "reviewer">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/critic.gif" alt="Critic" style="float:left;padding:5px;"/>
Steve Rhodes <br />
<em>Internet Reviews</em>
</p>
<p class = "quotebox">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/rotten.gif" alt="Rotten" style="float:left;padding:5px;"/>
<q>YOUR REVIEW HERE</q>
</p>
<p class = "reviewer">
<img src="http://www.cs.washington.edu/education/courses/cse190m/12sp/homework/2/critic.gif" alt="Critic" style="float:left;padding:5px;"/>
NAME <br />
<em>PUBLICATION</em>
</p>
</div>
And for reference, as well as to clarify my question, the output it supposed to look like this: http://courses.cs.washington.edu/courses/cse190m/12sp/homework/2/output/out-wide.png
So can anyone see why my floated columns aren't sitting beside the TMNT logo?
Alright, heres what I did: http://jsfiddle.net/PR3un/
<div class = "overview">
<img ... />
<dl>...</dl>
</div>
The only differences I did were...
Removed the clear:both,
Moved your dl into your ".overview" div
Removed the overview class from your dl
Floats are tricky. My favorite analogy that I tell my coworkers is this:
Using floats is like traveling through hyperspace. They exist, kinda, and can impact other DOM elements... but they are also travelling at a different dimensional plane (left-right). To bridge the float hyperspace travel, you can apply clear:both on itself or overflow:hidden on its parent.
... And if you apply float on a floating element's parent, it can provide a self-clear, but then the parent is traveling through hyperspace too.

Placing divs next to each other rather than below

I'm having trouble with placing divs next to each other rather than having them below. I'm new to using CSS and I'm not sure what I need to do exactly.
The webpage is www.panduzee.com/wordpress
The post "Richard Lu" is suppose to be next to "Ashley Lee."
The link to the code is: http://pastebin.com/J3CNMfaP
And the CSS is: http://pastebin.com/isn5NViA
Sorry, I tried getting the code to work within this post but it wasn't showing up correctly.
Any help would be appreciated! The CSS was from the wordpress theme, just letting you all know.
Thank you!
jsFiddle( http://jsfiddle.net/BnJ7g/3/ )
on your "boxes" and "boxes2" divs, add the float:left attribute.
<div id="boxes" style="float:left;">
<div class="box">
<!--The post title-->
Ashley Lee <!--The post image-->
<img width="210" height="312" src="http://www.panduzee.com/wordpress/wp-content/uploads/2012/04/527802_2560693355446_1797426028_1635316_739143794_n-210x312.jpg" class="attachment-homepage-thumb wp-post-image" alt="" title="" />
</div>
</div>
<div id="boxes2" style="float:left;">
<div class="box">
Richard Lu <!--The post image-->
<img width="210" height="312" src="http://www.panduzee.com/wordpress/wp-content/uploads/2012/04/527802_2560693355446_1797426028_1635316_739143794_n-210x312.jpg" class="attachment-homepage-thumb wp-post-image" alt="" title="" />
</div>
</div>
​

Resources