how to re-size the image flyer link in css - html

I have the image link which displayed on personal website.I am trying to re-size the image by creating css style sheets on this image since i was copy the code direct and paste to the page and i need to displayproperly on mobile devices
code
<div id="TA_selfserveprop634" class="TA_selfserveprop">
<ul id="FkGjsTFbWr" class="TA_links aICFqBWnArX">
<li id="v65BTuNt" class="Id2gL5m3F1"><a target="_blank" href= "https://www.tripadvisor.com/"><img src="https://www.tripadvisor.com/img/cdsi/img2/branding/150_logo-11900-2.png" alt="TripAdvisor"/></a>
</li></ul></div>
<script src="https://www.jscache.com/wejs?wtype=selfserveprop&uniq=634&locationId=307103&lang=en_US&rating=true&nreviews=5&writereviewlink=true&popIdx=true&iswide=false&border=true&display_version=2"></script>
</div>
</div>
CSS
.TA_selfserveprop{
width:10%;
height:10%;
}
.TA_links aICFqBWnArX{
width:10%;
height:10%;
}
.Id2gL5m3F1{
width:10%;
height:10%;
}
When refresh my page this CSS styles does not have any effects on image..
Can anyone let me know on how to rearrange the coding style so that the Size of the image displayed properly on my website.

If you want to make a div responsive and full screen at any device, you should use width: 100% and height: 100%.
#CDSWIDSSP {
width: 100%!important;
height: 100%!important;
}
.TA_selfserveprop {
width: 100%!important;
height: 100%!important;
}
body,
html {
width: 100%;
height: 100%;
}
#CDSWIDSSP .widSSPData {
height: 100%;
}
#CDSWIDSSP .widSSPData {
overflow: auto!important
}
<div id="TA_selfserveprop634" class="TA_selfserveprop">
<ul id="FkGjsTFbWr" class="TA_links aICFqBWnArX">
<li id="v65BTuNt" class="Id2gL5m3F1">
<a target="_blank" href="https://www.tripadvisor.com/">
<img src="https://www.tripadvisor.com/img/cdsi/img2/branding/150_logo-11900-2.png" alt="TripAdvisor" />
</a>
</li>
</ul>
</div>
<script src="https://www.jscache.com/wejs?wtype=selfserveprop&uniq=634&locationId=307103&lang=en_US&rating=true&nreviews=5&writereviewlink=true&popIdx=true&iswide=false&border=true&display_version=2"></script>
</div>
</div>
please note that for height: 100% you need to set this for body and html.

Related

Why is my image not covering the whole browser?

I'm having an issue where some images are not covering the entire width of the browser and some images are just too large to the point where you have to scroll right to see the entire image. I am using background-size:cover and I tried background-size: auto 100%; because that fixed it for some people. I want the background below my navbar to be an image, can someone help me understand why I am unable to achieve this?
<nav>
<ul class="navbar-list">
<li class="navbar-items">Home</li>
<li class="navbar-items">About</li>
<li class="navbar-items">Basics</li>
<li class="navbar-items">Contact</li>
</ul>
</nav>
<div class="body-img">
<img
src= "https://images.unsplash.com/photo-1508138221679-760a23a2285b?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80"
alt="sorry it looks like something went wrong."
/>
</div>
for my css I use : body-img img { background-size: cover; }
Set the width of body-img to width:100vw
You can also remove the padding and margin in the page using:
* {
padding: 0;
margin: 0;
}
Try it by using Flex.
.d-flex {
display: flex;
flex-flow: column;
height: 100vh;
}
.body-img {
flex: 1;
height: 100%;
}
.body-img img {
height: 100%;
width: 100%;
}
Html codes are like that.
<div class="d-flex">
<nav>
<ul class="navbar-list">
<li class="navbar-items">Home</li>
<li class="navbar-items">About</li>
<li class="navbar-items">Basics</li>
<li class="navbar-items">Contact</li>
</ul>
</nav>
<div class="body-img">
<img
src= "https://images.unsplash.com/photo-1508138221679-760a23a2285b?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80"
alt="sorry it looks like something went wrong."
/>
</div>
</div>
If you don't want the image stretching, remove width property.
Many problems with this.
.body-image img{
background-size:cover;
}
The img tag is not considered a container. Therefore background-size:cover; is not a appropriate style property for it.
If you intended to use a image as a background for a container; in this scenario a div element. You would call the image url through CSS vs using a img tag.
.body-image{
background-image: url('');
background-size: cover;
}
But wait this is still incomplete in order to scale the whole window size. Containers with no set width inherit the property width:auto;, so we will need to set the width of the container.
.body-image{
background-image: url('');
background-size: cover;
width:100%;
display:flex;
}
If you still insisted to keep a img tag. You would only need to set the width of both the container and the img tag.
so this code will also work for your desired effect.
.body-image{
display:flex;
width:100%;
}
.body-image img{
width:100%;
}

Image Displays over Content

I'm trying to add content on an image however I'm not sure where to place the code. When I place it above everything, it takes priority and none of my code shows. However when I place the image in the body CSS, it displays but I have problems trying to place my next line of code at the end of the image and not on the image below my last line of code which in this case is the Shop Now. I'm pretty sure I have placed the IMG code somewhere wrong. I appreciate anyone's help.
HTML:
<body>
<div class="Image">
<img src="C:\Users\Gabriel\Downloads\Green-blur.jpg"/>
<ul id="nav">
<li id="brand">MINIMAL</li>
<li id="navm">Men</li>
<li id="navm">Women</li>
<li id="navm">Contact</li>
</ul>
<h1>Simplicity is Minimal</h1>
<div id="home">
Shop Now
</div>
</div>
</body>
CSS:
<!--Content from code shows-->
body {
background-image: url();
background-size: 100% 130%;
background-repeat: no-repeat;
font-family: "PT Sans", sans-serif;
}
<!--IMAGE TAKES PRIORITY-->
img {
height: 1000px;
background-repeat: no-repeat;
}
Something like this?
body {
font-family: "PT Sans", sans-serif;
}
.image {
background: url("https://www.blogcdn.com/www.joystiq.com/media/2011/06/respawngameblurryimage530pxheaderimg.jpg");
background-size: cover;
}
li {
display: inline-block;
padding-right: 10px;
}
li a{
color: white;
}
<div class="image">
<ul id="nav">
<li id="brand">MINIMAL</li>
<li id="navm">Men</li>
<li id="navm">Women</li>
<li id="navm">Contact</li>
</ul>
<h1>Simplicity is Minimal</h1>
<div id="home">
Shop Now
</div>
</div>
Note: Removed the image in your HTML and added it to your CSS.
Hope it helped
What I understand from your question is that you want to put content over the image.
You can achieve this by using background image as you have done but for background image you have to provide the correct path of the image.
In your code
background-image: url('path of your image'):
background-size: contain;
Remove image tag from html.
From the looks of it, I think you're wanting that image to be the background on body, so you can move the src of your img into the background-url() property on body. And if you want the background to span the entire height of the browser window, add min-height: 100vh; to body.
body {
background-image: url(http://3.bp.blogspot.com/_EqZzf-l7OCg/TNmdtcyGBZI/AAAAAAAAAD8/KD5Y23c24go/s1600/homer-simpson-1280x1024.jpg); /* put your "C:\Users\Gabriel\Downloads\Green-blur.jpg" image here */
background-size: 100% 130%;
background-repeat: no-repeat;
font-family: "PT Sans", sans-serif;
min-height: 100vh;
}
<body>
<ul id="nav">
<li id="brand">MINIMAL</li>
<li id="navm">Men</li>
<li id="navm">Women</li>
<li id="navm">Contact</li>
</ul>
<h1>Simplicity is Minimal</h1>
<div id="home">
Shop Now
</div>
</body>
There are two ways to think about images and content on top of them. One would be to add a background-image to the element the content resides in. In other cases you'll want to use the image to maintain ratio and then position the content 'on top' with absolute positioning.
markup
<header>
<div class="stuff">Stuff here... example with background image</div>
</header>
<!-- OR -->
<div class="thing">
<img src="https://placehold.it/1600x900" alt="">
<div class="text">
Stuff here... example with absolute and relative positioning
</div>
</div>
styles
header { /* background image example */
background-color: lightblue;
padding: 10px;
background-image: url(https://placehold.it/1600x900);
}
.thing img {
display: block; /* so the image responds to it's parent */
width: 100%; /* */
height: auto; /* */
}
.thing { /* absolute position example */
position: relative; /* so it is the new boundery for children that are absolute */
max-width: 600px;
}
.thing .text {
position: absolute; /* this will take it out of the flow but let you position it based on parent */
top: 0;
left: 0;
padding: 1rem;
}
example: https://jsfiddle.net/sheriffderek/fvvq4cwq/

CSS bug with Image on responsive web page

I have a bug in my CSS when it comes to a responsive page with images.
Demo: https://jsfiddle.net/xr4getom/
You'll notice on this example that a dark background (#222) appears at times when you resize the window. Is there a fix for this that would just force the image to take up this area - while keeping the ratio correct?
I have omitted the CSS from here as it goes over the character limit but if you click the demo link, you can see it.
<section class="news-bloc">
<div class="news-container">
<h1>Latest News</h1>
<ul class="news-list">
<li>
<a href='#' target='_blank'><img alt='' class='img-responsive photo-thumb image-link' src='https://scontent.cdninstagram.com/t51.2885-15/s320x320/e15/c157.0.406.406/14504934_1825657564379158_1219547695887155200_n.jpg?ig_cache_key=MTQwMDU3NTA0ODg3NjAyNTIxNA%3D%3D.2.c'>
<p>View Post</p></a>
</li>
</ul>
</div>
</section>
Set the image in the background of your <a> instead of using <img> tag. Like:
HTML:
<ul class="news-list">
<li>
<a href='#' target='_blank' style="background-image: url('https://scontent.cdninstagram.com/t51.2885-15/s320x320/e15/c157.0.406.406/14504934_1825657564379158_1219547695887155200_n.jpg?ig_cache_key=MTQwMDU3NTA0ODg3NjAyNTIxNA%3D%3D.2.c');">
<p>View Post</p>
</a>
</li>
</ul>
CSS:
.news-list li a {
display: flex;
width: 100%;
height: 200px;
background-size: cover;
background-position: center;
}
Have a look at this jsFiddle Demo.
Hope this helps!
Your <li> element is having width more than that of image. Try setting your li width to auto -
ul.news-list li {
float: left;
width: auto; <-- Changed here
margin-right: 1.63934%;
float: left;
margin-bottom: 1.63934%;
background-color: #222
}
Found a solution! :-)
ul.news-list>li>a {
width: 100%;
}
you can use margin-bottom:-5px; in the css code

IE8 - when clicking on image inside a linked div, the link does not work

In other browsers this works, only in IE8 it does not from the ones I tried. In later Browser of internet explorer it works fine.
I have the following code:
CSS:
.imgcontainer {
display: block;
margin: 0 auto;
width: 100px;
height: 100px;
}
.imgcontainer img {
width: 75px;
height: 30px;
}
HTML:
<ul>
<li>
<a href="http://somelink.com">
<div class="imgcontainer">
<img src="img/someimage.png">
</div>
</a>
</li>
</ul>
What happens is the following: Anywhere around the image the link works, but as soon as I click on the image, the link does not respond. It is like the image is placed on top of the link.
Thanks in advance for your help
I've had the same issue recently and my solution was to bring the link inside the div and specify the width and height of it:
.imgcontainer {
display: block;
position:relative;
margin: 0 auto;
width: 100px;
height: 100px;
}
.imgcontainer a{
position:absolute;
top:0;
left:0;
width:100px;
height:100px;
}
.imgcontainer img {
width: 75px;
height: 30px;
}
<ul>
<li>
<div class="imgcontainer">
<a href="http://somelink.com">
<img src="img/someimage.png">
</a>
</div>
</li>
</ul>
This may not be the best solution but it has worked for me.

How can I make images stack on top of each other as web page scales down?

Basically there are two images that are supposed to be on the center of the page and when the page is made smaller those images need to stack vertically. Currently I can get them to scale vertically, but I don't know how to center them. If I use margins or padding they stay in their position when the page is shrunk and don't look very good. I need them to move towards the edge as the page is being shrunk and then stack once the width of the page is too small. I'm doing this so they display properly on mobile and smaller resolutions. Does anyone know the best way to do this?
Here is the html:
<body>
<div class="wrapper">
<div class="wordmark">
<a href="#">
<img src="........." />
</a>
</div>
</div>
<div class="logowrap">
<div class="row">
<ul class="thumbnails">
<div class="logo1">
<li class="span6 home-left">
<a href="#">
<img src="SDI-logo.png" alt="SDI-logo" />
</a>
</li>
</div>
<div class="logo2">
<li class="span6 home-right">
<a href="#">
<img src="Debate-Logo.png" alt="SDI-logo" />
</a>
</li>
</div>
</ul>
</div>
</div>
</body>
Here is the CSS:
.navbar {
background-color:#000;
}
.container{
background-color:transparent;
}
.wrapper {
background-color:#000;
}
.wordmark{
max-width:100%;
max-height:100%;
padding-left:15px;
}
.logo1{
float:left;
.logo2 {
float:inherit;
}
.logowrap{
}
I have changed your code a bit. Take a look here and see if that helps you (http://jsbin.com/UdODawI/1/)
.thumbnails {
width: 100%;
margin: 0 auto;
list-style-type: none;
}
.wrapper {
background-color:#000;
}
.logowrap {
margin: 0 auto;
text-align: center;
}
.logo1{
display: inline-block;
}
.logo2 {
display: inline-block;
}
try adding this css to your image
.thumbnails img {
max-width:100%;
height: auto;
}
this allows your images to resize according to its parent