I am trying to put various figures inside a division or a section which has a particular background color! I can not understand why the below code is not working! Please help!
<div style="algin:center;width:100%;height:auto;background-color:#212121">
<figure class="snip1197">
<figcaption>
<blockquote>Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.</blockquote>
<div class="arrow"></div>
</figcaption>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/331810/sq-sample10.jpg" alt="sq-sample10"/>
</figure>
</div>
I'm not sure what you mean but you can just add some more pictures or what you want.
* {
color:white;
algin:center;
}
.test{
algin:center;
width:100%;
height:auto;
background-color:#212121;
}
.arrow{
float:left;
width: 0;
height: 0;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-left: 10px solid green;
}
.test2{
algin:center;
width:100%;
height:auto;
background-color:red;
}
<div class="test">
<figure class="snip1197">
<figcaption>
<div class="arrow">
</div>
<blockquote>
Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.
</blockquote>
</figcaption>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/331810/sq-sample10.jpg" alt="sq-sample10"/>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/331810/sq-sample10.jpg" alt="sq-sample10"/>
</figure>
</div>
<!-- or with a figcaption for every picture and multiple figures in one div -->
<div class="test2">
<figure class="fig1">
<figcaption>
<div class="arrow">
</div>
<blockquote>
Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.
</blockquote>
</figcaption>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/331810/sq-sample10.jpg" alt="sq-sample10"/>
</figure>
<figure class="fig2">
<figcaption>
<div class="arrow">
</div>
<blockquote>
Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.
</blockquote>
</figcaption>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/331810/sq-sample10.jpg" alt="sq-sample10"/>
</figure>
</div>
i am guessing you want the image to blend on the background-color . you can use background-blend-mode for that. but you need to set background-color and background-image on the same element.
in the below example i used them on the div
see snippet or > jsfiddle
<div style="text-align:center;width:100%;height:auto;
background-color:#212121;background-blend-mode:multiply;
background-image:url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/331810/sq-sample10.jpg');
height:500px;
background-repeat:no-repeat;
background-position:center 100px">
<figure class="snip1197">
<figcaption>
<blockquote>Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.</blockquote>
<div class="arrow"></div>
</figcaption>
</figure>
</div>
P.S. 1) alignwas written wrong (algin ) and also align:center does not exist
P.S. 2) the above code is just an example. your question lacks a proper explanation on what you want to achieve
Related
I have the one issue with hr tags. There're two hrs in my html below which is decorated using CSS border. When I run the code the first one shows up as I intended nut the second one doesn't, even though they share the same CSS. How should I do???
Here's my code:
hr {
border: none;
border-top: 5px dotted #EAF6F6;
width: 5%;
margin-top: 50px;
margin-bottom: 50px;
}
<div class="middle-container">
<div class="profile">
<img src="resources/profile.png" alt="peofile-picture">
<h2>Hello.</h2>
<p>Learning web development skills. Just a drunk girl who's longing for Britain.</p>
</div>
<hr>
<div class="skills">
<h2>My Skills.</h2>
<div class="skill-row">
<img src="resources/coding.png" class="code-img" alt="coding">
<h3>WEB designing</h3>
<p>Please remember, I AM really a NEWBIE when it comes to designing the website.</p>
</div>
<div class="skill-row">
<img src="resources/beer.png" class="beer-img" alt="beer">
<h3>Drinking. Yes, JUST a drinking.</h3>
<p class="drink">Having good meal is pleasure. When it comes with good drink, that's far more better.</p>
</div>
</div>
<hr>
<div class="contact-me">
<h2>Get In Touch</h2>
<h3>But if you're interested in me...</h3>
<p>Please feel free to contact, there might be any help I can provide.</p>
<a class="btn" href="mailto:fictional#gmail.com">CONTACT ME</a>
</div>
</div>
I think you forgot an hr in your HTML, just check the picture below to understand :
I have a problem with mobile or small screen window browser, when the window browser width is small like the mobile screen the text will become above the next paragraph or above the photo image how can fix this issue
figure {
margin:0px;
margin-right:22px;
display:inline-block;
}
figure img {
vertical-align: top;
}
figure figcaption {
max-width:150px;
padding-top:8px;
line-height:1em;
text-align: center;
font-size:15px !important;
}
#text{
display:inline-block;
position:absolute;
margin:10px 0px;
}
<section>
<div style="display:inline-block;padding-top:8px;">
<figure>
<img src="http://placehold.it/200x200" alt="missing" width="150">
<figcaption>Album name goes here
<br>Year goes here
</figcaption>
</figure>
</div>
<div id="text">
<div style="font-size: 16px; margin-top: 0px;">“Knowing what to DO and Don’t with the customers allows them to close more sales and build an engaging, valuable and great experience with the customers. That OSN Super Agent course had a huge impact on our organizational performance across the region.”
<span style="font-size: 14px;">[Firas Suleiman - Learning & Development Delivery Manager - UAE]</span></div>
</div>
</section>
<section>
<div style="display:inline-block;padding-top:8px;">
<figure>
<img src="http://placehold.it/200x200" alt="missing" width="150">
<figcaption>Album name goes here
<br>Year goes here
</figcaption>
</figure>
</div>
<div id="text">
<div style="font-size: 16px; margin-top: 7px;">“The most exciting part is the difference between the normal agent and the super-agent and how the way of super-agent effect or change the idea to the customer and how should we deal with it. The course changes a lot in me in approaching customers, and that helped me to overachieve my target this month.”
<span style="font-size: 14px;">[Mujtaba Mohamed Ali - Direct location Leader – Bahrain]</span></div>
</div>
</section>
<section>
<div style="display:inline-block;padding-top:8px;">
<figure>
<img src="http://placehold.it/200x200" alt="missing" width="150">
<figcaption>Album name goes here
<br>Year goes here
</figcaption>
</figure>
</div>
<div id="text">
<div style="font-size: 16px; margin-top: 7px;">“It was one of the best courses I completed on the LMS. The most exciting part is that one of the sales agents was the actor. He showed me how does it work in the field. I learned about the “Dos and Donts”, asking the customer about his/her preferences not mine. Listen carefully and make the customer feel valued.”
<span style="font-size: 14px;">[Ahmed Hassan Ali - Customer care advisor – Egypt]</span></div>
</div>
</section>
Why are you position absolute in "text" div? That's was the problem come. Just remove it and add below css
#text {
display: inline-block;
/* position: absolute; */
margin: 10px 0px;
width: calc(100% - 200px);
vertical-align: top;
}
figure {
margin:0px;
margin-right:22px;
display:inline-block;
}
figure img {
vertical-align: top;
}
figure figcaption {
max-width:150px;
padding-top:8px;
line-height:1em;
text-align: center;
font-size:15px !important;
}
#text {
display: inline-block;
/* position: absolute; */
margin: 10px 0px;
width: calc(100% - 200px);
vertical-align: top;
}
<section>
<div style="display:inline-block;padding-top:8px;">
<figure>
<img src="http://placehold.it/200x200" alt="missing" width="150">
<figcaption>Album name goes here
<br>Year goes here
</figcaption>
</figure>
</div>
<div id="text">
<div style="font-size: 16px; margin-top: 0px;">“Knowing what to DO and Don’t with the customers allows them to close more sales and build an engaging, valuable and great experience with the customers. That OSN Super Agent course had a huge impact on our organizational performance across the region.”
<span style="font-size: 14px;">[Firas Suleiman - Learning & Development Delivery Manager - UAE]</span>
</div>
</div>
</section>
<section>
<div style="display:inline-block;padding-top:8px;">
<figure>
<img src="http://placehold.it/200x200" alt="missing" width="150">
<figcaption>Album name goes here
<br>Year goes here
</figcaption>
</figure>
</div>
<div id="text">
<div style="font-size: 16px; margin-top: 7px;">“The most exciting part is the difference between the normal agent and the super-agent and how the way of super-agent effect or change the idea to the customer and how should we deal with it. The course changes a lot in me in approaching customers, and that helped me to overachieve my target this month.”
<span style="font-size: 14px;">[Mujtaba Mohamed Ali - Direct location Leader – Bahrain]</span>
</div>
</div>
</section>
<section>
<div style="display:inline-block;padding-top:8px;">
<figure>
<img src="http://placehold.it/200x200" alt="missing" width="150">
<figcaption>Album name goes here
<br>Year goes here
</figcaption>
</figure>
</div>
<div id="text">
<div style="font-size: 16px; margin-top: 7px;">“It was one of the best courses I completed on the LMS. The most exciting part is that one of the sales agents was the actor. He showed me how does it work in the field. I learned about the “Dos and Donts”, asking the customer about his/her preferences not mine. Listen carefully and make the customer feel valued.”
<span style="font-size: 14px;">[Ahmed Hassan Ali - Customer care advisor – Egypt]</span>
</div>
</div>
</section>
Here is JSfiddle Demo
Hi HTML5 and CSS newbie here,
We had to create an interests page for our final project so I used 8 images stacked left to right contained in individual div containers with a caption that only appears when you hover over the photo. It looks fine in Chrome and Firefox, but in IE all the photos are everywhere. Any help would be appreciated:
HTML:
<section>
<div class="interests">
<img src="music.png" alt="Musician" id="musician">
<p class="caption" id="musicP">I love all genres of music.</p>
</div>
<div class="interests">
<img src="movies.png" alt="Popcorn" id="popcorn">
<p class="caption" id="movieP">Favorite romance comedy is Sleepless in Seattle</p>
</div>
<div class="interests">
<img src="reddit.png" alt="Reddit" id="reddit">
<p class="caption" id="redditP">I love Reddit. I spend way too much time there.</p>
</div>
<div class="interests">
<img src="reading.png" alt="Books" id="books">
<p class="caption">I only read fiction books.</p>
</div>
<div class="interests">
<img src="cooking.png" alt="Cooking" id="cooking">
<p class="caption" id="cookingP">Favorite food is sushi</p>
</div>
<div class="interests">
<img src="videogames.png" alt="Video Games" id="games">
<p class="caption">I'm playing Animal Crossing right now.</p>
</div>
<div class="interests">
<img src="football.png" alt="Football Game" id="football">
<p class="caption">My favorite player is Peyton Manning!</p>
</div>
<div class="interests">
<img src="travel.png" alt="Globe" id="travel">
<p class="caption">I'd like to visit Germany soon.</p>
</div>
</section>
CSS:
/*Styles for the Interests Page*/
/*Floats all the photos to the left*/
.interests {
float: left;
}
/*Styles for individual photos*/
#cooking{
height: 180px;
margin-left: 100px;
}
#books{
width: 240px;
height: 169px;
}
#games{
height: 180px;
}
/*Photo Caption Styles*/
.caption{
font-size: 70%;
visibility: hidden;
opacity: 0;
}
.interests:hover .caption{
visibility: visible;
opacity: 1;
}
#cookingP{
margin-left: 100px;
width:200px;
}
Thanks!
instead of
<img src="music.png" alt="Musician" id="musician">
close all your images to have a closing
<img src="music.png" alt="Musician" id="musician"/>
you are missing / in your image tags
Don't use floats. Use display:table on the <section> tag, display:table-cell on all the interest class divs, and wrap a div around the rows with the style display:table-row.
http://www.w3schools.com/cssref/pr_class_display.asp
My current output:
I want to make this kind of output:
How should I do this? I really don't have any ideas on this.
As of now here is my Html code:
<div id="Profile">
<p class="cover">
<img src="resources/default-cover.png" alt="">
</p>
<p class="profile-pic">
<img src="resources/default-male.png" alt="Male">
</p>
</div>
Firstly, your second class is in the wrong place; it should be in the opening paragraph tag, not the closing.
Secondly, try the following(assuming your class placement is correct):
.profile-pic {
margin-top: -50px;
}
HTML
<div id="Profile">
<p class="cover">
<img src="resources/default-cover.png" alt="">
</p>
<p class="profile-pic">
<img src="resources/default-male.png" alt="Male">
</p>
</div>
CSS
.profile-pic{
margin-top: -20px;
border-bottom: 40px solid white;
}
Your html is not valid with the class placed in the closing p tag.
There are many ways to do this. Here is one that cleans up your html.
I usually try to avoid using the p tag unless there are chunks of text inside it.
<div id="Profile">
<img src="resources/default-cover.png" alt="" class="cover">
<img src="resources/default-male.png" alt="Male" class="profile-pic">
</div>
Here is css to accomplish the effects. Place the size of your .profile-pic in the css.
<style type="text/css">
.cover {display:block;}
.profile-pic {position:relative; margin-top: -25px;height: 50px; width: 50px;}
</style>
I think this will be a simple fix for someone out there!
CSS:
#partners .social{
width:219.5px;
padding:10px;
float:left;
}
#partners .social .social-logo{
width:61px;
height:61px;
float:left;
}
#partners .social .social-text{
width:158.5px;
float:left;
}
HTML:
<div class="social">
<div class="social-logo"
<img src="images/fb-silver.png" alt="Find us on Facebook!" />
</div>
<div class="social-text">
Find us on Facebook
</div>
</div>
The image 'fb-silver.png' won't display.
I've tried to load the image outside of these tags and it's fine.
Any ideas?
Cheers!
Close your DIV, also half a pixel doesnt exist i think...
If this doesnt work, the url to your image will be wrong!
<div class="social">
<div class="social-logo">
<img src="images/fb-silver.png" alt="Find us on Facebook!" />
</div>
<div class="social-text">
Find us on Facebook
</div>
</div>