please help me with this CSS structure.
I need div with max width 240px , it should be center aligned(text left aligned), it should take width according to text means:
1). if text is less, then div width will be in accordance to text.
2). But if text is large , then div must expand upto 240px and put the text in ellipses
Please suggest.
Please see below code :
<style>
.showHide{overflow:hidden;max-width:240px;margin:4px;margin-left:auto;margin- right:auto;font-weight:normal;}
</style>
<div id="showHide" class="showHide">
<div>
<span style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 158px;display: inline-block;margin:4px;">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</span>
</div>
<div>
<span style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 158px;display: inline-block;margin:4px;">Customers_impacted</span>
</div>
<div>
<span style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 158px;display: inline-block;margin:4px;">Date</span>
</div>
-------------more divs here as above-------------------
</div>
<div>
<p>
Lorem Ipsum es simplemente el texto de relleno de las imprentas y archivos de texto. Lorem Ipsum ha sido el texto de relleno estándar de las industrias desde el año 1500, cuando un impresor (N. del T. persona que se dedica a la imprenta) desconocido usó una galería de textos y los mezcló de tal manera que logró hacer un libro de textos especimen. No sólo sobrevivió 500 años, sino que tambien ingresó como texto de relleno en documentos electrónicos, quedando esencialmente igual al original. Fue popularizado en los 60s con la creación de las hojas "Letraset", las cuales contenian pasajes de Lorem Ipsum, y más recientemente con software de autoedición, como por ejemplo Aldus PageMaker, el cual incluye versiones de Lorem Ipsum.
</p>
</div>
css
div{
width: auto;
max-width: 240px;
background-color: red;
}
p{
word-wrap: normal;
overflow-wrap: normal;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
this is your job :)
<div id="showHide" class="showHide">
<div><p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
</div>
<div>
<p>Customers_impacted</p>
</div>
<div>
<p>Date</p>
</div>
-------------more divs here as above-------------------
</div>
css
.showHide{
/**/
word-wrap: normal;
overflow-wrap: normal;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
/**/
max-width:240px;
margin:4px auto;
background-color: red;
}
p{
width: 158px;
word-wrap: normal;
overflow-wrap: normal;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 4px auto;
text-align: center;
background-color: green;
}
Here's what i came up with. Wrap your div in a parent div. Center align text on the parent div. Then display: inline-block the child div. See below.
HTML
<div class='mydiv'>
<div class='mydiv2'>
Hello World
</div>
</div>
CSS
.mydiv{
background: #ccc;
text-align: center;
}
.mydiv2{
background: #00CC00;
display: inline-block;
max-width: 240px;
}
Here's a working sample.
http://jsfiddle.net/h6Y63/1/
Related
The input number field doesn't render properly on ios. The number gets cut off at the bottom. It works for certain ios versions but not other ones. I'm stuck, please help
input[type=submit] {
text-align: center;
}
.page_q3 input[type="number"] {
height: 91px;
width: 110px;
color: #464356;
font-family: "Source Sans Pro";
font-size: 82px;
font-weight: 600;
text-align: center;
border: none;
border-bottom: 2px solid #464356;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
<div class="page_q3">
<div class="div_minus"><img src="<?=$templateDir?>/images/minus.jpg" class="minus" data-quantity="minus" data-field="<?=$inputName?>" /> </div>
<div class="div_number"><input type="number" id="<?=$inputName ?>" name="<?=$inputName?>" value="<?=$_SESSION[$inputName]?>" placeholder="0" /> </div>
<div class="div_plus"><img src="<?=$templateDir?>/images/plus.jpg"
class="plus" data-quantity="plus" data-field="<?=$inputName?>" /> </div>
</div>
What it should look like
https://ibb.co/y8msSpL
what it actually looks like
https://ibb.co/rkbyPF5
You might want to try removing the border-radius and padding that are added by iOS by default:
.page_q3 input[type="number"] {
-webkit-border-radius: 0;
border-radius: 0;
padding: 0;
}
I have problem with instagram image in my WKWebView. It does not shows properly. It show only 20% of that image
<html><head><script async src="http://platform.twitter.com/widgets.js" charset="utf-8"></script></head><body><p>Vest je potvrdio njegov sin Rik putem društvene mreže Instagram.</p>
<blockquote class="instagram-media" style="background: #FFF; border: 0; border-radius: 3px; box-shadow: 0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width: 658px; padding: 0; width: calc(100% - 2px);" data-instgrm-permalink="https://www.instagram.com/p/Bkc6yKGB3C9/" data-instgrm-version="8">
<div style="padding: 8px;">
<div style="background: #F8F8F8; line-height: 0; margin-top: 40px; padding: 50.0% 0; text-align: center; width: 100%;"> </div>
<p style="color: #c9c8cd; font-family: Arial,sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 0; margin-top: 8px; overflow: hidden; padding: 8px 0 7px; text-align: center; text-overflow: ellipsis; white-space: nowrap;"><a style="color: #c9c8cd; font-family: Arial,sans-serif; font-size: 14px; font-style: normal; font-weight: normal; line-height: 17px; text-decoration: none;" href="https://www.instagram.com/p/Bkc6yKGB3C9/" target="_blank" rel="noopener">A post shared by Rick Harrison (#rick_harrison)</a> on <time style="font-family: Arial,sans-serif; font-size: 14px; line-height: 17px;" datetime="2018-06-25T14:58:50+00:00">Jun 25, 2018 at 7:58am PDT</time></p>
</div>
</blockquote>
<p><br />"On je bio moj heroj. Kroz svoj život dotakao je duše mnogih ljudi, učio ih vrednostima života i porodice, teškog rada i humora", napisao je.</p>
<p>Ričard Harison rođen je 4. marta 1941. u Leksingtonu, Severna Karolina. U trenutku smrti imao je 77 godina.</p>
<p>"Zvezde zalagonica" je jedna od najpopularnijih emisija Histrory Channela od prvog emitovanja 2009. godine, koja gledaoce vodi kroz rad zalagaonice u Las Vegasu.</p>
<script async defer src="https://platform.instagram.com/en_US/embeds.js"> </script>
<style>img{display: inline; height: auto; max-width: 100%;}</style>
<style>iframe{display: inline; height: auto; max-width: 100%;}</style>
</body>
</html>
I'm designing a basic HTML signature. I do the HTML code in Dreamweaver (Mac), open to preview in firefox/safari and select all and drag the HTML into apple mails signature composer. It works well, and the signature looks good on desktop and ipad but doesen't work on iphone/smaller screen.
The signature looks like this (i've blacked out personal details):
The problem is on the smaller iphone, some of the text stays left of the picture, and some does not fit and ends up under the photo but with a margin. What would be ideal is if on iphone, I could config so all text and icons display below the main picture all the way left with no margin. Is it possible to set a different set CSS styles for iphone in a HTML email? or is there another way I can make my code more responsive?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Untitled Document</title>
</head>
<body>
<div id="sig-container" style="margin-top: 15px;padding-top: 6px; border-top: 1px dashed #ddd;">
<div style="float: left; margin: 2px 10px 5px 0px; border-right: 2px solid #000; padding-right: 30px; display: block;" id="photoWrapper"> <img src="http://websiteremoved/emailsm.jpg" id="sigPhoto" height="300px" width="200px"> </div>
<div style="margin-top:0px; margin-left: 74px;" id="sigDetailsWrapper"> <p style="font-family: Arial, sans-serif; font-size: 20px; line-height: 10px; color: #333; margin-top:10; margin-left:0; padding-left:0;"> <strong><span id="sigName">Name Removed</span></strong></span> <br>
<span id="sigTitle"><p style="font-family: Arial, sans-serif; font-size: 16px; line-height: 0px; color: #333; margin-top:0; margin-bottom:20px;margin-left:0; padding-left:0;">Title Removed | Title Removed</span><br>
<div><p style="font-family: Arial, sans-serif; font-size: 16px; line-height: 20px; color: #333;">
<span> email: emailremoved </span> <br>
<span> mobile: mobileremoved </span><br>
<span> web: websiteremoved</span> <br>
<span> facebook: facebook.com/facebookremoved</span> <br> <br>
<img src="http://websiteremoved/phone.jpg" height="62px" width="62px" style="color:#428BCA; text-decoration: none;" rel="nofollow">
<img src="http://websiteremoved/email.jpg" height="62px" width="62px" style="color:#428BCA; text-decoration: none;" rel="nofollow">
<img src="http://websiteremoved/web.jpg" height="62px" width="62px" style="color:#428BCA; text-decoration: none;" rel="nofollow"> </p> </div>
<div class="sep about" style="box-sizing: border-box;
background-attachment: scroll; height: 120px; position: relative;
-webkit-background-size: cover; background-size: cover;
background-image:
url('http://websiteremoved/about-sep.jpg');
z-index: 1; background-position: 50% -48.5px; background-repeat:
no-repeat no-repeat; "></div>
</div>
</body>
</html>
Yes, you can target iPhones using their retina screens. The media query should be "#media all and (min-device-pixel-ratio : 1.5)" For example...
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Untitled Document</title>
<style type="text/css">
#media all and (min-device-pixel-ratio : 1.5) {
#sigDetailsWrapper {margin-left: 0px !important;}
}
</style>
</head>
<body>
<div id="sig-container" style="margin-top: 15px;padding-top: 6px; border-top: 1px dashed #ddd;">
<div style="float: left; margin: 2px 10px 5px 0px; border-right: 2px solid #000; padding-right: 30px; display: block;" id="photoWrapper"> <img src="http://websiteremoved/emailsm.jpg" id="sigPhoto" height="300px" width="200px"> </div>
<div style="margin-top:0px; margin-left: 74px;" id="sigDetailsWrapper"> <p style="font-family: Arial, sans-serif; font-size: 20px; line-height: 10px; color: #333; margin-top:10; margin-left:0; padding-left:0;"> <strong><span id="sigName">Name Removed</span></strong></span> <br>
<span id="sigTitle"><p style="font-family: Arial, sans-serif; font-size: 16px; line-height: 0px; color: #333; margin-top:0; margin-bottom:20px;margin-left:0; padding-left:0;">Title Removed | Title Removed</span><br>
<div><p style="font-family: Arial, sans-serif; font-size: 16px; line-height: 20px; color: #333;">
<span> email: emailremoved </span> <br>
<span> mobile: mobileremoved </span><br>
<span> web: websiteremoved</span> <br>
<span> facebook: facebook.com/facebookremoved</span> <br> <br>
<img src="http://websiteremoved/phone.jpg" height="62px" width="62px" style="color:#428BCA; text-decoration: none;" rel="nofollow">
<img src="http://websiteremoved/email.jpg" height="62px" width="62px" style="color:#428BCA; text-decoration: none;" rel="nofollow">
<img src="http://websiteremoved/web.jpg" height="62px" width="62px" style="color:#428BCA; text-decoration: none;" rel="nofollow"> </p> </div>
<div class="sep about" style="box-sizing: border-box;
background-attachment: scroll; height: 120px; position: relative;
-webkit-background-size: cover; background-size: cover;
background-image:
url('http://websiteremoved/about-sep.jpg');
z-index: 1; background-position: 50% -48.5px; background-repeat:
no-repeat no-repeat; "></div>
</div>
</body>
</html>
You might want to recode this to use tables, though, as divs can often get messed up in Outlook, as well as Floats.
http://tinypic.com/r/hrbfic/5
Hello i got problem with my footer. The main section is overlapping my footer. Main section position is relative and footer position is absolute. I dont want my footer position to be fixed. Any ideas? Thanks.
html
{
margin: 0px;
padding: 0px;
border: 0px none;
outline: 0px none;
font-size: 100%;
background: none repeat scroll 0% 0% transparent;
}
body
{
background-image: url('/images/tlo.png');
background-repeat:repeat;
font-family: Tahoma,Verdana,Arial;
font-size: 100%;
height:100%;
}
h1, .leg
{
font-size:12px;
color: orange;
text-align:center;
}
h2
{
font-size:12px;
color: orange;
text-align:left;
}
p
{
color: white;
margin-top: .5em;
font-size: .75em;
padding-left:1%;
padding-right:1%;
}
.right
{
color: white;
margin-top: .5em;
font-size: .75em;
padding-left:5%;
text-align:right;
font-style:oblique;
}
#top
{
padding-top:60px;
padding-bottom:20px;
height:auto;
width:1024px;
overflow:hidden;
margin: 0px auto;
}
nav
{
border-width: thin;
border:1px solid gray;
background-image: url('/images/tweed.png');
}
header
{
background-image: url('/images/tlo.png');
}
#div1,#div2,#div3,#div4,#div5
{
position:relative;
padding:30px;
min-height:100%;
height:auto;
width:1024px;
background-image: url('/images/podklad.png');
border-width: thin;
border:1px solid gray;
margin:0px auto;
margin-top:20px;
margin-bottom:20px;
}
#menu
{
position:relative;
text-align: center;
height:120px;
width:100%;
margin: 0px auto;
border:0px;
font-size:0px;
background-image:url('/images/podklad.png');
background-repeat:repeat;
}
#stopka
{
position:absolute;
bottom:0px;
left:0px;
width:100%;
height:100px;
background-image:url('/images/podklad.png');
background-repeat:repeat;
margin: 0px auto;
}
ul.lista
{
text-align:center;
list-style-type:none;
margin:0;
}
ul#jezyki
{
list-style: circle;
color: white;
margin-top: .5em;
font-size: .75em;
text-align:center;
}
li.lista
{
display:inline;
margin: 0px auto;
}
.linki
{
font-size:14px;
color:white;
font-weight:bold;
}
.clear {
display:block;
float:none;
clear:both;
height:0px;
width:100%;
margin:0;
padding:0;
border:0;
}
?>
<!doctype html>
<head>
<title>Damian Pruszynski Webdesign</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
<link href='http://fonts.googleapis.com/css?family=Habibi' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="sliding_effect.js"></script>
<script type="text/javascript" src="mojefunkcje.js"></script>
<meta name="keywords" content="Damian Pruszynski, webdesign, bialystok webdesign, strony www, programowanie bialystok, pisanie stron www, pisanie stron www bialystok, robienie stron www bialystok, robienie stron" />
<meta name="description" content="Damian Pruszynski - strona domowa, programowanie i webdesign. Programowanie stron www - HTML5 CSS3 jQuery. Skrypty PHP5 Javascript. Bannery oraz grafiki promujące. Łatwo tanio i przyjemnie."/>
<meta name="author" content="Damian Pruszyński"/>
<meta name="robots" content="index,follow" />
<meta charset="UTF-8"/>
</head>
<body>
<header>
<div id="toppodklad"></div>
<div id="top">
<img src="/images/logotop.png" alt="logo glowne" />
</div>
</header>
<nav>
<div id="menu">
<ul class="lista">
<li class="lista"><a id="pokaz1" href="index.php" ><img src="/images/pasek_01.png" alt=" " /></a></li>
<li class="lista"><a id="pokaz2" href="autor.php" ><img src="/images/pasek_02.png" alt=" " /></a></li>
<li class="lista"><a id="pokaz3" href="projekty.php" ><img src="/images/pasek_03.png" alt=" " /></a></li>
<li class="lista"><a id="pokaz4" href="kontakt.php" ><img src="/images/pasek_04.png" alt=" " /></a></li>
<li class="lista"><a id="pokaz5" href="logowanie.php" ><img src="/images/pasek_05.png" alt=" " /></a></li>
</ul>
</div>
</nav>
<div id="container">
<div id="div1">
<?php
include("newsy.php");
?>
</div>
</div>
<div id="stopka"></div>
</body>
</html>
use (clear:both;) in css hope it helps
I am using the code below. What I want to do is have a + or - sign on expanded or collapsed view. How can I do that? Here is the code:
<!--//---------------------------------+
// Developed by Roshan Bhattarai |
// http://roshanbh.com.np |
// Fell Free to use this script |
//---------------------------------+-->
<title>Collapsible Message Panels</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//hide the all of the element with class msg_body
$(".msg_body").show();
//toggle the componenet with class msg_body
$(".msg_head").click(function(){
$(this).next(".msg_body").slideToggle(100);
});
});
</script>
<style type="text/css">
body {
margin: 10px auto;
width: 570px;
font: 75%/120% Verdana,Arial, Helvetica, sans-serif;
}
p {
padding: 0 0 1em;
}
.msg_list {
margin: 0px;
padding: 0px;
width: 383px;
}
.msg_head {
padding: 5px 10px;
cursor: pointer;
position: relative;
background-color:#FFCCCC;
margin:1px;
}
.msg_body {
padding: 5px 10px 15px;
background-color:#F4F4F8;
}
</style>
</head>
<body>
<div align="center">
<p>Click on the each news head to toggle
</p>
</div>
<div class="msg_list">
<p class="msg_head">Header-1 </p>
<div class="msg_body">
orem ipsum dolor sit amet
</div>
<p class="msg_head">Header-2</p>
<div class="msg_body">
consectetuer adipiscing elit orem ipsum dolor sit amet
</div>
</div>
</body>
</html>
Change the markup of the msg_head to something like this-
<p class="msg_head">Header-1 <span>[-]</span></p>
and change the toggle function to look like this-
$(".msg_head").click(function(){
$(this).next(".msg_body").slideToggle(100);
})
.toggle( function() {
$(this).children("span").text("[+]");
}, function() {
$(this).children("span").text("[-]");
});
Easiest way to do this is with the .toggleClass( className ). Using this method you can add or remove a class from an element. So modifying your code to the (untested) code below should do the trick. You'll want to offset the padding by an equivalent amount to fit your graphic files.
JavaScript
$(".msg_head").click(function() {
$(this).next(".msg_body").slideToggle(100);
$(this).toggleClass('msg_head_expanded');
});
CSS
.msg_head
{
padding: 5px 10px;
cursor: pointer;
position: relative;
background:#FFCCCC url('plus.png') no-repeat 0 50;
margin:1px;
}
.msg_head_expanded
{
background:#FFCCCC url('minus.png') no-repeat 0 50;
}
I have this very thing on my own website. Here's how I do it:
$(".question").click(function () {
if ($(this).next(".answer").is(":hidden")) {
$(this).next(".answer").slideDown("slow");
$(this).children('span').text('-');
} else {
$(this).next(".answer").slideUp("slow");
$(this).children('span').text('+');
}
});
The HTML looks like this:
<div class="question">
<span>+</span>blahblah
</div>
<div class="answer">blahblah</div>