i have some issues with positioning my modal. I spend lot of time trying to swipe my modal component between other components to get better result but right now i don't really know how to fix it. I have a signup form and I want to trigger the modal in the center of the screen when user click on the button below. Problem is, modal is not opening in the center, its opening from position it was triggered.
I have to use absolute class because if I wont, modal is not overriding the page. Any suggestions?
Here is the modal code
import { Component, createSignal } from "solid-js";
const TermsModal = function () {
const [isOpen, setIsOpen] = createSignal(false);
return (
<div class="flex absolute justify-center">
<button
class="text-sm font-bold text-blue-500 uppercase focus:outline-none"
onClick={() => setIsOpen(true)}
>
Privacy Policy
</button>
{isOpen() && (
<>
<div
role="presentation"
class=""
onClick={() => setIsOpen(false)}
onKeyPress={(e) =>
(e.key || e.code) === "Escape" ? setIsOpen(false) : null
}
></div>
<section
role="dialog"
class=" p-4 text-center border-gray-200 rounded-lg shadow sm:p-8 bg-zinc-700"
>
<button aria-label="Close Dialog" onClick={() => setIsOpen(false)}>
× Close button
</button>
{/* Here starts modal content */}
<h1>Terms of Service</h1>
{/* Here ends modal content */}
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Nisi
quaerat totam cumque hic voluptatum sit ratione itaque aspernatur,
possimus ex beatae quo repudiandae dignissimos iure eum
exercitationem labore, corrupti adipisci.
</p>
</section>
</>
)}
</div>
);
};
export default TermsModal;
And here is how i am calling a modal. Its inside the input form together with checkbox. (I also want to make it in one line, but failed)
<label class="text-white m-5 p-1">
<input type="checkbox" checked={false} onChange={handleCheck} />
I have read and agree to the <TermsModal />{" "}
</label>
That is probably because you are rendering the modal window as a child component of some element. You need to use Portal to render the modal window as a direct child of the body element so that it won't be affected by its parent's z-index or other css properties.
import { render, Portal } from "solid-js/web";
const style = `
border: 1px solid red;
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
display: flex;
flex-flow: column no-wrap;
align-items: center;
justify-content: center;
`
const Component = () => {
return <div style={style}>Inner Content</div>
};
const App = () => {
return <Portal mount={document.body}><Component /></Portal>;
};
render(() => <App />, document.body);
https://playground.solidjs.com/anonymous/13e0670c-79e3-4899-8ed0-151dd531e8c2
You can learn more about Portal:
https://www.solidjs.com/docs/latest#portal
https://www.solidjs.com/tutorial/flow_portal?solved
If you don't want to use a portal and don't need reactivity inside the modal window, you can use onMount hook to append the modal window to the body element and onCleanup to remove it.
import { batch, createSignal, onMount, onCleanup } from "solid-js";
import { render } from "solid-js/web";
const style = `
border: 1px solid red;
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
display: flex;
flex-flow: column no-wrap;
align-items: center;
justify-content: center;
`
const Component = () => {
const modal = document.createElement("div");
modal.innerHTML = "Some Content";
modal.setAttribute("style", style);
onMount(() => {
document.body.appendChild(modal);
});
onCleanup(() => {
document.body.removeChild(modal);
});
return null;
};
const App = () => {
return <Component />;
};
render(() => <App />, document.body);
I'm trying to create a list item that looks like your typical inbox message.
The demo shown in the components docs shows the timestamp being added as an ion-note but is missing in markup provided.
When I inspect the demo HTML, it seems classes like item-inner and input-wrapper are used. I can't seem to find information about them anywhere.
Do I write my own CSS to lay these things out or is there a correct ionic way to do this that I'm missing?
I figured it out a while ago but haven't got around to answering my own question. Here it is.
My ion-item markup:
<ion-item text-wrap>
<ion-avatar item-left>
<img src="http://i.pravatar.cc/80?u=judywong">
</ion-avatar>
<h2>Jane Doe</h2>
<ion-note item-right>4:00 pm</ion-note>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor…</p>
</ion-item>
Then I use CSS to position it to the top while using item-right attribute to position to the right the ionic way.
ion-note {
align-self: flex-start;
line-height: 1.8rem;
position: absolute;
top: 0;
right: $item-ios-padding-right/2;
}
Also added some right padding to h2 to clear the timestamp.
I'm working on an html email that needs to render well on the Blackberry OS. The formatting of the text keeps getting blown up in Blackberry, see screenshots.
Blackberry ------------ Correct ------------
Here is my current code -
<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center" style="background-color:#000000 !important;padding:0;" bgcolor="#000000">
<tr>
<td style="color:#ffffff;font-size:12px;background-color:#000000;" bgcolor="#000000" valign="top">
<span style="font-weight:bold;font-size:22px;mso-line-height-rule:exactly; line-height:24px;">
Aliquam Commodo Velit vel Ipsum
</span>
<span style="mso-line-height-rule:exactly; line-height:13px;">
<br>
</span>
Duis consectetur velit vel ipsum interdum anella onsequat lacus mattis.
</td>
</tr>
</table>
Any thoughts would be greatly appreciated. This is wracking my brain. Thanks!
this did it for me:
#media (max-width: 600px) {
* { -webkit-text-size-adjust:none; }
}
try adding min-width='600px' to the table, as some devices dont like widths in % (eg. Androids). Also, note the font-size=12px is applied to both the <span> as its applied to the <td>.
It is obvious that the font-size:22px is overriding the font-size:12px given in td. What you can do is that instead of span divide your td into two td's and let them have the different font-sizes' html emails get the font from the td and not span tags.
I've encountered a rather strange bug in UIWebView. If I create a table and on of the <td>:s are too long (longer than the width of the screen, I guess), the font size gets enlarged!
Here is an example app I threw together to demonstrate this.
This piece of HTML:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
table
td
{
white-space: nowrap;
}
</style>
</head>
<body>
<table>
<tr>
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mi ipsum</td>
</tr>
<tr>
<td>Lorem ipsum dolor sit amet.</td>
</tr>
</table>
<table>
<tr>
<td>Lorem ipsum dolor sit amet.</td>
</tr>
<tr>
<td>Lorem ipsum dolor sit amet.</td>
</tr>
</table>
</body>
</html>
Produces this result:
The top table gets enlarged! The ONLY thing that's different is that the first line is longer in the top table. This makes the font size for the whole table bigger!
I've tried using <nobr> instead of CSS and it gives the same result. Setting the font size with inline styles does not work either.
I also get the same result if I set the width of a <td> to a size larger than the screen, so it seems like there is some auto sizeing that is the problem.
Does anyone know a workaround for this?!
UPDATE
Here is my project if you want to try it out for yourself:
http://cl.ly/2B3r1F2C3I0C2D1S2X3s
UPDATE 2
I forgot to mention that I have tried setting font sizes throigh CSS. Both in the <style> and inline and even through JavaScript, after the page has loaded loke so:
.
td
{
font-size: 18px;
}
<td style="font-size: 18px;">
var elements = document.getElementsByTagName('td');
for(int i = 0; i < elements.length; i++)
{
elements[i].style.fontSize = '18px';
}
This has no effect.
var elements = document.getElementsByTagName('td');
for(**var** i = 0; i < elements.length; i++) {
elements[i].style.fontSize = '18px';
}
I don't see any font sizes being specified. I would try manually setting the font sizes with CSS or HTML.
I'm having some difficulty getting my website to display properly when viewed on the iPhone and iPad. The webiste (not even close to being finished) is
www.lzkconcepts.com.
The website displays properly when viewed on every desktop browser I've tried (safari, chrome, firefox, IE), however, on the iPhone/iPad there is a tiny gap/space between the "content" div and header and footer. I'm using a background image in the header, content, and footer divs to create the outline of the page. In addition to the gaps between the divs, the content background image is sometimes "shrunk" a little, so that it doesn't line up with the header and footer on the right side of the screen. If I zoom in though, everything lines up perfectly. Here's a screenshot taken from the iPhone...
http://s1139.photobucket.com/albums/n545/lhkimbrough/?action=view¤t=7198e49b.jpg&evt=user_media_share
Look closely at the right side below the blue navigation bar.
Here's the CSS (I know it's very rough, I'm just learning)
#charset "UTF-8";
body {
margin: 0;
padding: 0;
color: #000;
font-family: Arial, Helvetica, sans-serif;
font-size: 100%;
line-height: 1.4;
background-color: #CCC;
}
.TableAppName {
color: #007EB4;
}
/* ~~ Element/tag selectors ~~ */
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
padding-right: 15px;
padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
}
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
border: none;
}
/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
a:link {
color: #42413C;
text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
}
a:visited {
color: #6E6C64;
text-decoration: underline;
}
#h-navbar {
font-size: 95%;
background-color: #CCC;
background-image: url(images/navBarBlue.png);
background-repeat: no-repeat;
text-align: right;
padding-right: 20px;
color: #FFF;
height: 39px;
padding-top: 6px;
}
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
text-decoration: none;
}
/* ~~ this fixed width container surrounds the other divs ~~ */
.container {
width: 874px; /* the auto value on the sides, coupled with the width, centers the layout */
margin-top: 0;
margin-right: auto;
margin-bottom: 0;
margin-left: auto;
background-color: #CCC;
}
/* ~~ the header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo ~~ */
.header {
background-color: #CCC;
background-image: url(images/BannerFadedBlueAndOrangeText.png);
background-repeat: no-repeat;
height: 165px;
}
/* ~~ This is the layout information. ~~
1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.
*/
.content {
background-color: #CCC;
background-image: url(images/contentFadedDark4.png);
background-repeat: repeat-y;
padding-left: 15px;
}
.contentBottom {
padding: 0px;
margin: 0px;
}
/* ~~ The footer ~~ */
.footer {
background-color: #CCC;
background-image: url(images/FooterFadedDark.png);
background-repeat: no-repeat;
text-align: right;
font-size: 80%;
}
/* ~~ miscellaneous float/clear classes ~~ */
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the #footer is removed or taken out of the #container */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
#h-navbar a, #h-navbar a:visited {
text-decoration: none;
color: #FFF;
}
#h-navbar a:hover {
color: #ea6828;
}
.footer p {
color: #0075A7;
}
.content h1 {
color: #0074A9;
font-weight: normal;
font-size: 200%;
font-style: normal;
padding-top: 15px;
padding-left: 23px;
}
.graytext {
color: #333;
}
And here's the HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/LZKConcepts_Template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>LZK Concepts</title>
<!-- InstanceEndEditable -->
<link href="LZKConcepts_styles.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>
<body>
<div class="container">
<div class="header"><!-- end .header --></div>
<div id="h-navbar"> Home | QuickGrader | Wish On A Star | About Us | Contact Us </div>
<!-- InstanceBeginEditable name="MainContent" -->
<div class="content">
<h1>
<!-- end .content -->
iPhone Apps</h1>
<table width="844" border="0">
<tr>
<td width="160" rowspan="2" valign="top"><img src="images/QuickGraderIconReflected140.png" alt="QuickGrader" width="120" height="154" hspace="20" /></td>
<td width="482" class="TableAppName">QuickGrader</td>
<td width="188"> </td>
</tr>
<tr>
<td height="127" valign="top" class="graytext">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris neque quam, facilisis sed iaculis tempor, iaculis vitae purus. Mauris eros lacus, commodo ut feugiat vel, sollicitudin et elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur urna diam, iaculis ut commodo molestie, congue non lacus. </td>
<td align="right" valign="top"><br />
<img src="images/App_Store_Badge.png" alt="AppStore" width="155" height="54" hspace="18" vspace="0" align="right" /></td>
</tr>
</table>
<p> </p>
<table width="844" border="0">
<tr>
<td width="160" rowspan="2" valign="top"><img src="images/Wish On A Star Reflected.png" alt="QuickGrader" width="120" height="154" hspace="20" /></td>
<td width="482" class="TableAppName">Wish On A Star</td>
<td width="188"> </td>
</tr>
<tr>
<td height="130" valign="top">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris neque quam, facilisis sed iaculis tempor, iaculis vitae purus. Mauris eros lacus, commodo ut feugiat vel, sollicitudin et elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur urna diam, iaculis ut commodo molestie, congue non lacus. </td>
<td align="right" valign="top"><br />
<img src="images/App_Store_Badge.png" alt="AppStore" width="155" height="54" hspace="18" align="right" /></td>
</tr>
</table>
<p> </p>
<table width="844" border="0">
<tr>
<td width="160" rowspan="2" valign="top"><img src="images/Wish On A Star Free Reflected.png" alt="QuickGrader" width="120" height="154" hspace="20" /></td>
<td width="482" class="TableAppName">Wish On A Star Free</td>
<td width="188"> </td>
</tr>
<tr>
<td height="130" valign="top">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris neque quam, facilisis sed iaculis tempor, iaculis vitae purus. Mauris eros lacus, commodo ut feugiat vel, sollicitudin et elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur urna diam, iaculis ut commodo molestie, congue non lacus. </td>
<td align="right" valign="top"><br />
<img src="images/App_Store_Badge.png" alt="AppStore" width="155" height="54" hspace="18" align="right" /></td>
</tr>
</table>
</div>
<!-- InstanceEndEditable -->
<div class="footer">
<p><br />
<br />
<br />
Copyright © 2010, LZK Concepts. All rights reserved.</p>
</div>
<!-- end .container --></div>
</body>
<!-- InstanceEnd --></html>
Does anyone have an idea why the iPhone and iPad are rendering the page like this?
On an iPad, when a website is viewed at a scale under 100%, some artefacts appear sometimes. One is particularly visible: a 1 pixel lines between divs, just like on your site, under the menu.
The solution I found is to add a "margin: -1px" between divs. Divs backgrounds overlap with 1 pixel, and if slicing is done accordingly, its invisible for a classic browser, and corrects the problem on the iPad.
Use:
meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"
for when a website is being displayed on a tablet or other device. That should get rid of the pixel difference you see. Sites should be designed semantically scalable these days for maximum cross device access.
As for me, I normally build a php device detecter if there absolutely needs to be a work around.