image overlay another image - html

On MY WEBSITE
I have this code:
<div>
<center><img src="images/ipadframe.png" width="200" height="300"></center>
</div>
<div style="position:absolute; left:233; top:35;">
<img src="images/xclomobi.jpg" width="152" height="233">
</div>
<div class="section_w280 fl">
<ul class="future_project"><br><br>
<li>Website: #</li>
<li>Role:<font size="2"> CSS / PHP / MYSQL</font></li>
<li>#li>
</ul>
<div class="cleaner"></div>
</div>
<div class="section_w140 fr"><br><br>
<div class="rc_btn_02">Visit</div>
<div class="cleaner"></div>
</div>
<div class="margin_bottom_20 border_bottom"></div>
</div>
which displays perfectly on my desktop but not on my ipad or smaller screens.
how do I edit the div style above so that it loads reads an alternative code when viewing this on a device listed above?
Is there a way to get it to display correctly no matter what device they are viewing it on?

What you need is implement Responsive design by using #mediaquerys...
iPAD Portrait and Landscape
#media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) { /* STYLES GO HERE */}
iPAD LANDSCAPE
#media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) { /* STYLES GO HERE */}
iPAD PORTRAIT
#media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) { /* STYLES GO HERE */ }
By using this, you can set the CSS styles only for that device...
Also need to read this...

Another alternative I find myself jumping into are responsive frameworks like Bootstrap or Foundation by ZURB. They provide a stunning amount of components to get you on your responsive way in record time. Both have their pros and cons, you should eval which one suits your needs.

Related

HTML image sizes and srcset attributes not working

I have a Blade directive that generates an HTML <img> tag with srcset and sizes attributes. But only the 1280px option is used, regardless of the resolution (I do tests in Edge through the device emulation feature).
<img src="https://my.link/logos/casa-nova/logo.png" srcset="
https://my.link/logos/casa-nova/logo414.png 414w,
https://my.link/logos/casa-nova/logo768.png 768w,
https://my.link/logos/casa-nova/logo1024.png 1024w,
https://my.link/logos/casa-nova/logo1280.png 1280w,
https://my.link/logos/casa-nova/logo.png" sizes="
(max-width: 414px) 414px,
(max-width: 768px) 768px,
(max-width: 1024px) 1024px,
(max-width: 1280px) 1280px,
100vw" width="213" height="67" alt="alt">

srcset - show different image based on device

I am tring to show different image based on screen resolution in one <img tag, i read several tutorial but i can't get it work
Screen < 768px show banner_mobile.png (500x500)
More than 768px show banner_desktop.png (1370x200)
<img
srcset="banner_mobile.png 768w,
banner_desktop.png 1024w"
sizes="(max-width: 768px) 768px,
(max-width: 1024px) 1024px"
src="banner_desktop.png"
alt="test">

Bad value for attribute sizes on element img on w3 validator

while validating my page on w3 I get lots of errors like:
Bad value (max-width: 768px) 321px,(min-width: 768px)
407px,(max-width: 768px and min-resolution: 2dppx) 642px,(min-width:
768px and min-resolution: 2dppx) 814px,321px for attribute sizes on
element img: Bad media condition: Parse Error at …resolution: 2dppx)
I understand that something is wrong with the sizes attribute, but still can't find out what
This is the html
<img
class="polaris__image lazyload"
alt=""
height="188"
role="presentation"
sizes="(max-width: 768px) 321px,(min-width: 768px) 407px,(max-width: 768px and min-resolution: 2dppx) 642px,(min-width: 768px and min-resolution: 2dppx) 814px,321px"
src="https://media.itpro.co.uk/image/upload/t_card-mobile#1/v1570816514/itpro/2019/04/arcserve_udp_9240dr.jpg"
srcSet="https://media.itpro.co.uk/image/upload/t_card-mobile#1/v1570816514/itpro/2019/04/arcserve_udp_9240dr.jpg 321w,https://media.itpro.co.uk/image/upload/t_card-desktop#1/v1570816514/itpro/2019/04/arcserve_udp_9240dr.jpg 407w,https://media.itpro.co.uk/image/upload/t_card-mobile#2/v1570816514/itpro/2019/04/arcserve_udp_9240dr.jpg 642w,https://media.itpro.co.uk/image/upload/t_card-desktop#2/v1570816514/itpro/2019/04/arcserve_udp_9240dr.jpg 814w" width="321"
/>
Is the combined use of max/min-width and min-resolution an error?I alkso tried using PPI but it still returns an error.

How to get rid of spaces on mobile version

Currently in my style.css file I am using certain designs only for the mobile version of my website.
Here is the beginning tag:
#media only screen and (min-width : 150px) and (max-width : 780px)
I want to be able to set it up so that when the site is on a mobile device it does not use the &nbsp that is shown below, I want to only use &nbsp in the full desktop. Is there a way to handle this in a css file?
<td colspan="2" style="font-size: 16pt;">
Home
All Products
</td>
If you want to use CSS for that. Then on the desktop site you would have to write the HTML as this
<td colspan="2" style="font-size: 16pt;">
Home
All Products
</td>
cannot be removed dynamically using CSS. JavaScript can handle these events, but CSS is not designed to handle this.
This way you can control the space between the elements using CSS. Now in the media style, you can remove this margin.
#media only screen and (min-width : 150px) and (max-width : 780px) {
td a:nth-child(2) {
/* second a */
margin-left: 0;
}
}
I think there are two possible solutions:
Use margins instead of since the non-breaking space is protected and cannot be removed via CSS. You could apply margin:0 3%; or something alike to the anchors.
Wrap that s by a span: <span class="spacer"> </span> and apply display:none when on mobile.

CSS/HTML - Hide images on mobile phone and use an alternate text

I currently have a page that generates a table from an SQL database using PHP, including one column that contains images. Due to us now having to work on a mobile platform, I'm looking for a way to hide the images. I'm currently using display: none on an antiscreen.css file, but as the images are links, it doesn't show the links
For clarity, when the image is on a PC browser it appears like this:
<td>
<a href="link to image source:>
<img height=80 alt='Text I want to display' src="link to image source" />
</a>
</td>
And when on a mobile the image, link and text are hidden using the display:none method.
So how would you recommend I work this out?
I would probably do this:
<td>
<a href="link to image source:>
<img height=80 alt='Text I want to display' src="link to image source" />
<span class="mobileonly" src="link to image source">Text I want to display</span>
</a>
</td>
Then I would set span.mobileonly { display: none; } on the main stylesheet and span.mobileonly { display: inline; } in antiscreen.css. The advantage is that the mobile link will also be easy to style.
Another option, which works for all screen sizes under a certain nr. of pixels is to use a media query, basically similar to the above one but with the advantage that it works on any screen size smaller than the defined number of pixels.
/* Media Query for mobile */
#media screen and (max-width: 480px) {
/* This resizes tables and images to be 100% wide with a proportionate width */
/* Hide stuff on mobiles */
table[class=emailnomob],td[class=emailnomob],img[class=emailnomob],span[class=emailnomob]{display:none !important;}
/* Additional Media Query for tablets */
#media screen and (min-width: 480px) and (max-width: 1024px) {
/* Hide stuff on tablets */
table[class=emailnomob],td[class=emailnomob],img[class=emailnomob],span[class=emailnomob]{display:none !important;}
This should covers both mobile and tablet devices.
Code courtesy of .net email tutorial. I only stripped the parts you don't need.
Usage:
<img class="emailnomob" height=80 alt="Text I want to display" src="link to image source" />