Align two images with text [closed] - html

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I want to align the two pictures at the top of this site http://paulcwebster.com
with the text beside them.
So far, I was able to align two images beside each other, but I have the problem of:
1) The text not having any space between the images.
2) The text being too short or too long for the images on different browsers.
3) Not having the text size match the site of the pictures
4) Not being able to move the text "Recent Publications" to the left after (I've triend align="left" and putting it in it's own div)
Here is my code:
<div >
<img src="gfx/FrontImage1.jpg" width="180" height="180" alt="Image1" style="float:left">
<img src="gfx/FrontImage3.jpg" width="180" height="180" alt="Image2" style="float:left">
<span ><p>Paul Christopher Webster is a freelance writer and documentary film director based in Toronto, Canada. He has reported from 20 countries since 1992.</p>
Paul's work in film has appeared on the Arte, BBC, CBC, Deutsche Welle, Discovery, National Geographic, Slice, SWR and Vision Television networks. His work as a writer has been published in dozens of magazines, journals and newspapers across Canada, the U.S, and Europe. </p>
<p>He has won four national magazine awards for his writing, and Tier One Journalism Award from the Canadian Institutes of Health Research. His work on documentary films has garnered awards from the Canadian Association of Journalists, Hot Docs, the Canadian Academy of Film and Television, and PARISCIENCE, the international festival of scientific films.
<p>Paul’s work focuses on themes in business, science, and politics. For samples of his work in these categories, please click on the links to articles below.
</span>
</div>

First, I recommend restructuring your HTML markup. Put a <div> or other block-level element around each of the elements you want to control. Something like this:
<div class="container">
<div class="photos">
<img src="gfx/FrontImage1.jpg" width="180" height="180" alt="Image1">
<img src="gfx/FrontImage3.jpg" width="180" height="180" alt="Image2">
</div>
<div class="text">
Your text goes here...
</div>
</div>
Then, write some CSS to control these elements the way you want:
.container {
overflow:hidden; // this keeps the floated objects inside the container
padding:5px;
border:solid 1px black;
}
.container .photos {
float:left;
margin-right:10px; // this puts some padding to the right of the photos
}
I am assuming here that you know how to include a stylesheet to apply the above CSS to your page. This should solve problems 1) and 4). There really isn't any way to ensure that the size of the text always matches the height of the images, as it can flow and change, depending on the width of the browser, and the font size that the viewer is using, so I don't see a way to solve problems 2) and 3).
Note: I see that you are using a <span> element to contain your <p> elements. This is invalid markup, since a <span> is an inline element, and a <p> is a block level element. Inline elements cannot contain block level elements.

Related

I'm trying to edit a CANVAS page but I think I've done something wrong with the inline-block so my image and text doesn't sit side by side

Normally I would use a CSS page, but i don't think i can do that with canvas :(
<div id="Bell_hooks" class="">
<h3><i class="fas fa-chalkboard-teacher" aria-hidden="true"> </i>Philosopher's perspective - <em>Bell Hooks</em></h3>
</div>
<div style="display: flex;">
<div>
<p><img src="https://info.umkc.edu/womenc/wp-content/uploads/2015/12/bellhook.jpg" alt="Bell Hooks" width="300" height="366" /></p>
</div>
<div>
<p>In her 1999 book "All about love" Bell Hooks comments on both the romance culture of today's world and the subtle sexism embedded into our everyday love life. In the first few chapters of book, Hooks brings up the state of the newer generations' views on love, in which she states how she was "sad" and "appalled" at how the younger regards love and romance culture, quoting the reply of someone she had interviewed: "Love what's that, I have never had any love in my life". Hooks comments on the more modern view on love, in which claims that more and more younger people are defining love as something "for the naïve, the weak, the hopelessly romantic.". After bringing up her viewpoint, Hooks presents a theory in which she theorises that our cynicism stems from the reoccurring feeling that love will not and cannot be found, on which she expands by theorising that this is ultimately because we are simply trying hide behind the mask of cynicism to hide our disappointed and betrayed heart. In her book, Hooks quotes multiple other philosophical works such as When all you've ever wanted isn't enough (Harold Kushner) and Bitch: In Praise of Difficult Women (Elizabeth Wurtzel), in which both works theorise that the newer generation are growing up much more apprehensive about loving, and that "None of us are getting better at loving: we are getting more scared of it."</p>
</div>
</div>
this is my full code, but once i add the flex display the image shrinks to the size of one line of text, is there any way to fix that?
here's what it looks like now
This is an example using flexbox. Wrap your divas in a container and give it a display: flex.
<div class="container" style="display: flex">
<div>
<img src="https://info.umkc.edu/womenc/wp-content/uploads/2015/12/bellhook.jpg" alt="Bell Hooks" width="300" height="366">
</div>
<div>
<p>In her 1999 book "All about love" Bell Hooks comments on both the romance culture of today's world and the subtle sexism embedded into our everyday love life</p>
</div>
</div>

How to solve image colors fading when uploaded in a html file

I added some images to my website and the colors in them faded out.
here is the section where I am adding one of the images in the HTML
<section id="two" class="spotlight style2 right">
<div class="image fit main"><img src="images/1111.jpg" alt="" /></div>
<div class="content">
<header>
<h2>Courses & Projects</h2>
<p>For Adults and Students</p>
</header>
<p>Robone team developed their own educational curriculum based on studying students’ behavior, especially students’ stress arousals and their effects on students’ understanding.</p>
<p>One of the most unique factors of Robone is their curriculum, which is updated quarterly based on technology updates and facilities.</p>
<p>. Moreover, Robone team design their curriculum based on a combination between international advanced course text books and elementary courses.</p>
<ul class="actions">
<li>Learn More</li>
</ul>
</div>
Next
</section>
I tried using different extensions of the image (.jpg, .jpeg, .png) but still the colors fade out.
I would comment rather than answer, but I don't have enough 'reputation'...
Try looking at style definition for .image and see if there's an opacity setting less than value of 1.
I can only guess without CSS to look at.
The problem you are (probably) facing is that your image has a (not supported) color profile. You should first convert your image to a sRGB image (safe RGB) in Photoshop or a similar program. You might experience the same 'fading' while converting. When you correct that and save as sRGB your image will show up exactly as intended. Any other color profile suffers from interpretation errors by your webbrowser/computer/device (this is partly why 'Save For Web' is invented).
sRGB: the color profile used by most web browsers to display images on the web.
Some background info, and
some more...

Acceptable to include a definition list within a <figcaption> tag?

Background
I am using Swiper to create a slider for a restaurant website and I would like to code it as semantically as possible. To give you an idea of the content, each slide has four main features:
Background image
Menu category (i.e. sandwiches)
Menu item
Menu item description
If you need a visual (and an appetite):
My Solution
This was the most semantic way I could think of to code it:
<figure class="swiper-slide">
<img src="img/hammin-it-up.jpg" alt="" />
<figcaption>
<strong class="slider-menu-category">Sandwiches</strong>
<dl class="slider-menu-item">
<dt>Hammin' It Up</dt>
<dd>Fontina Cheese & Blackforest Ham grilled on Texas Toast</dd>
</dl>
</figcaption>
</figure>
My Question/s
Is it semantically friendly and w3-OK to use a <dl> within a <figcaption> tag?
Is there a more semantic way to show the slide "title" (aka category) than using a class? I realize this is a separate question, but it's related and I couldn't cram all that into the post title...
My Research
I could not find a site with an exact match to what I did, but I found some that were close:
MDN has some examples with a <cite> tag inside a <figcaption>.
HTML5 Doctor has an <a> and <code> inside the same.
An S.O. user posted an indirectly related question, but I noticed within their markup some <p> tags inside a <figcaption>.
w3.org indicates nothing suggesting my method was incorrect, so I am semi-sure it's fine, but any feedback would be appreciated.
Yes, dl is allowed inside of figure/figcaption: dl is flow content, and figure/figcaption expect flow content according to their content model.
However, I don’t think it’s the best choice in your specific example.
The dl doesn’t really add anything to understanding the content of this figure. It would be appropriate if there were several name-value pairs (e.g., "Price", "Ingredients" etc.), but what you currently have is just a title and a description.
The strong element doesn’t seem to be used according to its definition ("strong importance, seriousness, or urgency") here.
And I also think that the category/title/description isn’t really a caption for the photograph in this case; to me, it seems these 4 elements should be on the same level, so to say. But this is open for interpretation and also depends on the context where this slideshow will be shown.
Instead of using figure, I think that each menu item should be an article. This choice enables the use of headings and header elements:
<article>
<img src="" alt="" />
<header>
<div>Sandwiches</div>
<h1>Hammin' It Up</h1>
</header>
<p>Fontina Cheese & Blackforest Ham grilled on Texas Toast</p>
</article>
use <div> .. </div> for everything , <figcaption> is allowed with HTML5
sticking with div's will be compatable with any browser on any device. You can use a title attribute if you'd like. You can also have any attribute as long as it starts with data-
and example would be <div class="exampleClass" data-title="My Title" data-info="My other info">

HTML CSS Float Images Around Text NOT Text Around Image

So my title, I hope, pretty much explains what I am trying to do - Floating text around an image is easy - I want the opposite, if I have some text, and multiple images I want the images to float around the text.
Google pretty much just returns "floating text around an image" so I hope you guys can help.
E.G. Suppose I have this HTML (pls ignore the inline styling):
<div>
<img src="http://upload.wikimedia.org/wikipedia/en/thumb/4/45/F1_logo.svg/220px-F1_logo.svg.png" style="float: right; clear:both; margin-top:10px;">
<img src="http://upload.wikimedia.org/wikipedia/en/thumb/4/45/F1_logo.svg/220px-F1_logo.svg.png" style="float: right; clear:both; margin-top:10px;">
<img src="http://upload.wikimedia.org/wikipedia/en/thumb/4/45/F1_logo.svg/220px-F1_logo.svg.png" style="float: right; clear:both; margin-top:10px;">
<img src="http://upload.wikimedia.org/wikipedia/en/thumb/4/45/F1_logo.svg/220px-F1_logo.svg.png" style="float: right; clear:both; margin-top:10px;">
<img src="http://upload.wikimedia.org/wikipedia/en/thumb/4/45/F1_logo.svg/220px-F1_logo.svg.png" style="float: right; clear:both; margin-top:10px;">
<img src="http://upload.wikimedia.org/wikipedia/en/thumb/4/45/F1_logo.svg/220px-F1_logo.svg.png" style="float: right; clear:both; margin-top:10px;">
<img src="http://upload.wikimedia.org/wikipedia/en/thumb/4/45/F1_logo.svg/220px-F1_logo.svg.png" style="float: right; clear:both; margin-top:10px;">
<img src="http://upload.wikimedia.org/wikipedia/en/thumb/4/45/F1_logo.svg/220px-F1_logo.svg.png" style="float: right; clear:both; margin-top:10px;">
<img src="http://upload.wikimedia.org/wikipedia/en/thumb/4/45/F1_logo.svg/220px-F1_logo.svg.png" style="float: right; clear:both; margin-top:10px;">
<img src="http://upload.wikimedia.org/wikipedia/en/thumb/4/45/F1_logo.svg/220px-F1_logo.svg.png" style="float: right; clear:both; margin-top:10px;">
<img src="http://upload.wikimedia.org/wikipedia/en/thumb/4/45/F1_logo.svg/220px-F1_logo.svg.png" style="float: right; clear:both; margin-top:10px;">
<p>Formula One, also known as Formula 1 or F1 and referred to officially as the FIA Formula One World Championship,[2] is the highest class of single-seater auto racing sanctioned by the Fédération Internationale de l'Automobile (FIA). The "formula", designated in the name, refers to a set of rules with which all participants' cars must comply.[3] The F1 season consists of a series of races, known as Grands Prix (from French, originally meaning great prizes), held throughout the world on purpose-built circuits and public roads. The results of each race are evaluated using a points system to determine two annual World Championships, one for the drivers and one for the constructors. The racing drivers, constructor teams, track officials, organisers, and circuits are required to be holders of valid Super Licences, the highest class of racing licence issued by the FIA.[4]</p>
<p>F1 cars are the fastest multi-turn circuit-racing cars in the world, owing to very high cornering speeds achieved through the generation of large amounts of aerodynamic downforce. Formula One cars race at speeds of up to 350 km/h (220 mph) with engines currently limited in performance to a maximum of 15,000 RPM. The cars are capable of lateral acceleration in excess of five g in corners. The performance of the cars is very dependent on electronics – although traction control and other driving aids have been banned since 2008 – and on aerodynamics, suspension and tyres. The formula has radically evolved and changed through the history of the sport.</p>
<p>While Europe is the sport's traditional base, and hosts about half of each year's races, the sport's scope has expanded significantly during recent years and an increasing number of Grands Prix are held on other continents. F1 had a total global television audience of 527 million people during the course of the 2010 season.[5]</p>
<p>Grand Prix racing began in 1906 and became the most popular type internationally in the second half of the twentieth century. The Formula One Group is the legal holder of the commercial rights.[6] With annual spending totalling billions of US dollars, Formula One's economic effect and creation of jobs is significant, and its financial and political battles are widely reported. Its high profile and popularity have created a major merchandising environment, which has resulted in great investments from sponsors and budgets in the hundreds of millions for the constructors. Since 2000 the sport's spiraling expenditures have forced several teams, including manufacturers' works teams, into bankruptcy. Others have been bought out by companies wanting to establish a presence within the sport, which strictly limits the number of participant teams.</p>
Now this ALMOST achieves what I want until the number of images means that the images are "longer" than the text. When the images are longer than the text I then want them to wrap underneath the text, e.g.
text text text text IMAGE
text text text text IMAGE
text text text text IMAGE
text text text text IMAGE
IMAGE IMAGE IMAGE IMAGE
IMAGE IMAGE IMAGE IMAGE
Is this possible? I need to achieve it using only HTML and CSS.
For every page I want to do this the text length and number of images could be different.
Thank you to anyone who replies.
Here's my solution dev'd using the kind answers below - I didn't get exactly what I wanted originally but I got something that fulfilled my purpose.
Note that this puts the images on the left hand side - not right as originally asked for above - it looked neater on the left.
HMTL:
<div id="maindata">
<div id="maintext">
<h2>Ferrari</h2>
<p>They are red.</p>
<P>I like them</p>
</div>
<img class="image" src="http://www.myimagehost.com/ferrari1.jpg" />
<img class="image" src="http://www.myimagehost.com/ferrari2.jpg" />
<img class="image" src="http://www.myimagehost.com/ferrari3.jpg" />
<img class="image" src="http://www.myimagehost.com/ferrari4.jpg" />
<img class="image" src="http://www.myimagehost.com/ferrari5.jpg" />
<img class="image" src="http://www.myimagehost.com/ferrari6.jpg" />
</div>
CSS:
#maindata {
float: left;
width: 100%;
}
#maindata #maintext{
margin-top: 15px;
float: right;
width: 63%;
padding: 10px;
}
#maindata .image{
max-width:28%;
margin-top: 15px;
padding: 10px;
}
Fiddle of solution: http://jsfiddle.net/k0rsc5u7/
I would start by first floating the text 'container' to the left with a width less than the page width so that you have space left for the images to sit, then just add the images.
They should start after the text then fall to the left of the page once they reach the bottom.
There may be other things to consider, like when you have your images to the right of the text, in your example they are one on top of the other, then when they fall to the left, they are side by side - you may need more html/css to sort this.
When you want to float text around an image, you apply float to the image.
Here, you want to float images around a text, so you should apply float to the text ;)

Writing good "alt" content? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
What is it the best practice with regards the alt attribute of images?
For example, say I have an image with a caption that says "We look after our staff" and the accompanying image is a picture of a man looking out of a van windows towards the camera, for the alt content should I have something like:
"We look after our staff" (A copy of the image caption)
OR
"A picture of a man looking out of a van windows towards the camera" (A description of the image)
Taken from the w3 spec, reworded;
There is no "wrong" or "right" way of writing alt tags, as it is relative to the context. For example, take the following scenario; on your site, the end user is asked to pick his favourite colour:
The alt tags would be as follows:
<ul>
<li><img src="red.jpeg" alt="Red"></li>
<li><img src="green.jpeg" alt="Green"></li>
<li><img src="blue.jpeg" alt="Blue"></li>
</ul>
A second scenario is if you had a logo which in turn links through to the website, the alt tag should be a description of the link:
A well written alt tag would be:
<a href="http://w3.org">
<img src="images/w3c_home.png" width="72" height="48" alt="W3C web site">
</a>
More applicable for YOUR scenario would be the following examples.
Here is an example of an image closely related to the subject matter of the page content but not directly discussed. An image of a painting inspired by a poem, on a page reciting that poem. The following snippet shows an example. The image is a painting titled the "Lady of Shallot", it is inspired by the poem and its subject matter is derived from the poem. Therefore it is strongly recommended that a text alternative is provided. There is a short description of the content of the image in the alt attribute and a link below the image to a longer description located at the bottom of the document. At the end of the longer description there is also a link to further information about the painting.
Which should have the following code for the alt text
<header><h1>The Lady of Shalott</h1>
<h2>A poem by Alfred Lord Tennyson</h2></header>
<img src="shalott.jpeg" alt="Painting of a young woman with long hair, sitting in a wooden boat. ">
<p>Description of the painting.</p>
<!-- Full Recitation of Alfred, Lord Tennyson's Poem. -->
...
...
...
<p id="des">The woman in the painting is wearing a flowing white dress. A large piece of intricately
patterned fabric is draped over the side. In her right hand she holds the chain mooring the boat. Her expression
is mournful. She stares at a crucifix lying in front of her. Beside it are three candles. Two have blown out.
Further information about the painting.</p>
However.... sometimes an alt tag can be left out all together. For example, if you had the above image with a contextual description relative to the image on the page directly below:
Join us for our medieval theme nights every Friday at Boaters Bar, on
the riverside, Kingston upon Thames.
For the above example, either of the following solutions would be conforming:
<p><img src="shalott.jpeg" alt=""></p>
<p>Join us for our medieval theme nights every Friday at
Boaters Bar,on the riverside, Kingston upon Thames.</p>
Or
<p><img src="shalott.jpeg" alt="Painting of a woman in a white flowing dress, sitting in a small boat."></p>
<p>Join us for our medieval theme nights every Friday at Boaters Bar,
on the riverside, Kingston upon Thames.</p>
Extract from w3.org
When an image contains words that are important to understanding the
content, the alt text should include those words. This will allow the
alt text to play the same function on the page as the image. Note that
it does not necessarily describe the visual characteristics of the
image itself but must convey the same meaning as the image.
Example 1
An image on a Website provides a link to a free newsletter. The image
contains the text "Free newsletter. Get free recipes, news, and more.
Learn more." The alt text matches the text in the image.
Example 2
An image on a Web site depicts the floor plan of a building. The image
is an image map with each room an interactive map area. The alt text
is "The building's floor plan. Select a room for more information
about the purpose or content of the room." The instruction to "select
a room" indicates that the image is interactive.
http://www.w3.org/TR/WCAG20-TECHS/H37
Warning: this answer is rather subjective.
I use this attribute especially at images having a special function. For example a image of a disk on which the user can click for saving something. Then the value of alt would be "save".
But I don't think you should give a description of every picture. Just say "gallery image" or something like this.
Remember, the alt is for the text replacement for the imagine.
Many cases, I leave have alt = "" because there is no text that would replace that imagine.
Other times, just a single character is best:
<img src="fancy_bullet_point.gif" alt="*">
Just remember the basic rule of thumb: If you did not have the image, what would you put there instead?