fix the alignment of contents of <div> - html

I am trying to add a div for social network widgets to the end of the footer on my website.The code works out on my desktop,but the contents alignment is changed when I test it on ipad,iphone and windows phone.Here is the code:
<div style="background-color: #1E2629;">
<div class="container">
<div class="row text-center">
<div>
<ul class="list-inline">
<li>
<div class="fb-like" style="overflow:hidden;" data-href="https://www.facebook.com/WebsitePage" data-layout="button" data-action="like" data-show-faces="true" data-share="false"></div>
</li>
<li>
<div>
Follow #CardInbox
<script>!function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https'; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = p + '://platform.twitter.com/widgets.js'; fjs.parentNode.insertBefore(js, fjs); } }(document, 'script', 'twitter-wjs');</script>
</div>
</li>
<li>
<div>
<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/FollowCompany" data-id="111111">
</script>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>

Add media queries for each device screen size,
/* Ipad Portrait and Landscape */
#media only screen
and (min-device-width: 768px)
and (max-device-width: 1024px)
and (-webkit-min-device-pixel-ratio: 1) {
/* your css code
.container {} */
}
/* iPhone 4/4s Portrait and Landscape */
#media only screen
and (min-device-width: 320px)
and (max-device-width: 480px)
and (-webkit-min-device-pixel-ratio: 2) {
/* your css code
.container {} */
}
/*5/5S */
#media only screen
and (min-device-width: 320px)
and (max-device-width: 568px)
and (-webkit-min-device-pixel-ratio: 2) {
}
Windows phones comes in different screen size. So configure accordingly .

Related

Tailwind CSS responsive behavior on nextjs app

I'm new in Tailwind CSS. I build to the user interface of nextjs application by starting "mobile first" like everybody. Flex direction, background color are working at mobile size screen. So tailwind css is correctly importing nextjs application. When change the screen size, not change to flex direction or background color of navigation bar.
Navbar code is shared below:
export default function Home() {
return (
<div>
<Head>
<title>Tailwind CSS Tutorial</title>
<meta name="description" content="Generated by create next app" />
<meta name="viewport" content="width=device-width, initial-scale=1"></meta>
<link rel="icon" href="/favicon.ico" />
</Head>
<main>
<header className="bg-gray-700 shadow-md sm:bg-red-900">
<nav className="flex flex-col items-center sm:flex-row sm:justify-between sm:items-left">
<div className="w-screen text-center px-5 py-2 text-white border-b sm:border-b-0 sm:w-auto">
W3Learn
</div>
<div className="py-2">
<a className="px-10 text-white" href="/html-lecture"> HTML</a>
<a className="px-10 text-white" href="/css-lecture"> CSS </a>
<a className="px-10 text-white" href="/js-lecture"> JS </a>
</div>
</nav>
</header>
</main>
</div>
)
}
tailwind configuration is shared below:
module.exports = {
mode: "jit",
purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
darkMode: false,
theme: {
extend: {},
screens: {
},
},
variants: {
extend: {},
},
plugins: [],
}
Cause of problem is missing breakpoints configuration. I add the below breakpoints
configuration lines in screens. Actually, this lines are coming default and though missing lines, this app must be running without error.
'sm': '640px',
// => #media (min-width: 640px) { ... }
'md': '768px',
// => #media (min-width: 768px) { ... }
'lg': '1024px',
// => #media (min-width: 1024px) { ... }
'xl': '1280px',
// => #media (min-width: 1280px) { ... }
'2xl': '1536px',
// => #media (min-width: 1536px) { ... }

Using width with orientation

I have some div classes:
<a href="https://adsler.co.uk/wp-user-test-dashboard-2/awpcp-reply-
to-ad/31/3-books/"><div class="email"><span><center><span class="fa
fa-envelope"></span></center></span></div></a><a href="tel:<br/>.
<label>Phone:</label> XXXX. XXXX XXXX"><div class="phone"><span>.
<center><span class="fas fa-phone"</span></center></span></div></a>
<a href="http://maps.google.com/maps?q=<br/><label>Location:</label>
London, London,
UK&zoom=14&size=512x512&maptype=roadmap&sensor=false""><div
class="location"><span><center><span class="fas fa-map-marker-alt".
</span></center></span></div></a>
One,.email i can't seem to alter the width in orientation:landscape
Tried css:
#media (max-width: 768px)and (orientation: landscape){.email {padding:0px; position: unset; float:unset; width: unset;background-color:unset; margin:unset; height:unset; display:unset;}}
and
#media (max-width: 768px)and (orientation: landscape){.awpcp-subtitle >.email {width: 10px !important; display:block;}}
Page for mobile landscapes view :https://adsler.co.uk/wp-user-test-dashboard-2/awpcp-show-ad/31/3-books/london/uk/london/business-advert/

How to change width of element that has Bootstrap styling applied

I have col-sm-4 Bootstrap classes applied to some list elements that are inside a jQuery slider (lightslider) component.
When the screen is between 801px and 991px, I want the list element to increase to 160px since currently, it is too small and the data is squashed a bit.
In Chrome developer tool, the styling is applied from the following css:
element.style {
width: 142px;
margin-right: 10px;
}
This is my HTML:
<ul id="responsive" >
#foreach (var item in Model.Categories)
{
<li id="list-size-increase" class="col-sm-4 align-centre list-size-increase">
<a href="#Url.Action("Products", "Home", new { id = item.Id, categoryName = item.Name })">
<img src="#item.OutputImage" alt="#item.Image" />
<div class="blend-box-top category-head" style="background: #0197BA url(#item.OutputImage) no-repeat 50% 0%;">
<div class="item-container">
<div class="desc-plus">
<p>#item.Name</p>
<p>+</p>
</div>
</div>
</div>
</a>
</li>
}
</ul>
I've attempted with this id class, but I see no change:
#media (min-width: 801px) and (max-width: 991){
.list-size-increase{
width:160px;
}
}
This solved it:
#media (min-width: 801px) and (max-width: 991px){
.list-size-increase {
width: 160px !important;
}
}
The !important keyword allows new styling to take precedence over inline styles. Oh how I love remembering and learning.

#media in my HTML isn't working

The #media rules aren't making the different PHP pages appear and disappear. Am I doing it wrong? Also is there a better way of doing this?
This is the style within my index page and it's contained in the <head>. I'm also using external style sheets but I didn't think it'd be necessary to include them.
<style type="text/css">
<!-- Show Normal -->
#media only screen and (min-device-width: 768px) {
div#show-normal { display:block; }
div#show-mobile { display:none; }
}
<!-- Show Mobile -->
#media only screen and ((min-height : 320px) and (max-device-width : 667px)) {
div#show-normal { display:none; }
div#show-mobile { display:block; }
}
</style>
This is all of the contents of my body tag
<body>
<!-- Default -->
<div id="show_normal">
<!-- HEADER -->
<?php
include("pages/default/header.php");
?>
<!-- CONTENT -->
<div id="contentContainer">
<?php
include ("pages/default/infoStrip.php");
include ("pages/default/productStrip.php");
include ("pages/default/slideshowStrip.php");
include ("pages/default/footer.php");
?>
</div>
</div>
<!-- Mobile -->
<div id="show_mobile">
<!-- HEADER -->
<?php
include("pages/mobile/header.php");
?>
<!-- CONTENT -->
<div id="contentContainer">
<?php
include ("pages/mobile/infoStrip.php");
include ("pages/mobile/productStrip.php");
include ("pages/mobile/slideshowStrip.php");
include ("pages/mobile/footer.php");
?>
</div>
</div>
</body>
the closing parenthesis after
(max-device-width : 667px)
is missing
or better: take out one of the opening parenthesis in
((min-height : 320px)

Retina images with Picturefill?

I'm having a bit of trouble understanding how to implement retina images with Picturefill
This is what I have...and I don't think it's working:
<picture>
<img
src="img/small.jpg"
srcet=
"img/large.jpg" data-media="(min-width: 800px) 900w"
"img/large.jpg" data-media="(min-width: 800px) and (min-device-pixel-ratio: 1.5) 1800w"
"img/medium.jpg" data-media="(min-width: 640px) 640w"
"img/medium_2x.jpg" data-media="(min-width: 640px) and (min-device-pixel-ratio: 1.5) 1280w"
"img/medium.jpg" data-media="(min-width: 320px) 320w"
"img/medium_2x.jpg" data-media="(min-width: 320px) and (min-device-pixel-ratio: 1.5) 640w"
size="100%"
alt="">
</picture>
The media-queires pull the images that are 2x bigger. Set it to 1.5 for Android devices.