Well, I've got a really annoying problem: my table columns keep getting cut off at lower resolutions, particularly # 800 x 600.
Here's an example of how it should look like (1920 x 1080):
And here's how it looks # 800x600:
EDIT:
html:
<div class="tablewrapper">
<div class="center2">
<div class="component">
<table>
<tr>
<c:forEach items="${nombreColumnas}" var="columnas" >
<th><c:out value="${columnas}"/></th>
</c:forEach>
</tr>
<c:forEach items="${suscripciones}" var="item" >
<tr>
<td><c:out value="${item.idSuscripcion}"/></td>
<td><c:out value="${item.nombreCompleto}"/></td>
<td><c:out value="${item.fechaUltimoPago}"/></td>
<td><a href="">
<button type="button" class="button-table"><i class="fa fa-plus-circle"></i> Asignar apadrinado</button></a></td>
</tr>
</c:forEach>
</table>
</div>
</div>
css:
.tablewrapper {
display: inline-block;
position: relative;
margin-left: 10%;
width:80%;
max-width: 80%; }
.center2 {
display: inline-block;
position: relative;
margin-right: 100px;
width:100%;
max-width: 100%;}
What could it be?
Related
I created a table using bootstrap, and put it in a div of class container-fluid. On a desktop view it looks like this:
In my CSS I used #media in order to determine certain width under which my container-fluid will take 100% of the screen, but still on mobile view, part of the right side of the table is hidden, and I have to horizontally scroll in order to see it. It looks like this:
My relevant html code is:
<div class="container-fluid" id="tableCont">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Product Name</th>
<th title="Quantity of the product" scope="col">Quantity</th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Tomato </td>
<td><input type="number" min="1" max="50"></td>
<td><button title="Include product in list">Include</button></td>
<td> <button type="button" class="btn btn-labeled btn-danger">
<span class="fa fa-remove"></span> Remove</button>
</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Potato</td>
<td><input type="number" min="1" max="50"></td>
<td><button title="Include product in list">Include</button></td>
<td> <button type="button" class="btn btn-labeled btn-danger">
<span class="fa fa-remove"></span> Remove</button></td>
</tr>
My relevant CSS is:
.table {
width: 100%;
}
#tableCont {
margin-top: 0;
height: 400px;
overflow-y: auto;
border: white;
width: 68%;
}
#media (max-width: 600px) {
#tableCont {
width: 100%;
}
}
How can I set the mobile view so the whole width of the table will be visible with no horizontal scrolling?
Try changing width to max-width in media query.
#media (max-width: 600px) {
#tableCont {
max-width: 100%;
}
put this in your head tag Html:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
and on your CSS:
.table {
display: flex;
justify-content: center;
margin: 0 auto;
width: fit-content;
}
and if you want your content to start from the left side and still fit the screen put this code in #tableCont:
#tableCont {
display: inline-block;
float: left;
}
you can solve this problem with CSS grid as well, so if that interests you
visit https://www.w3schools.com/css/css_grid.asp
I have css sheet that keeps making one of my webpages have the same opacity as the background image, but it doesn't do it to the others. I don't want the whole page to have the opacity, just the background. I've played around with it but I'm not exactly sure why it's doing it to this page in particular. The only thing that's different is that this page has a table, the others either have a form or don't have one. Let me know if I should share some of the html.
The css that's causing it:
div::after {
min-height: 100%;
min-width: 1024px;
pointer-events: none;
width: 100%;
height: auto;
top: 0;
left: 0;
content: "";
display: block;
position: fixed;
background: url(brain.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
opacity: 0.1;
}
Added html:
<html>
<head>
<meta charset="utf-8" />
<script>
function display() {
document.getElementById("displayarea").innerHTML = document.getElementById("fname").value;
document.getElementById("fname").value = "";
document.getElementById("displayarea1").innerHTML = document.getElementById("pname").value;
document.getElementById("pname").value = "";
document.getElementById("displayarea2").innerHTML = document.getElementById("rname").value;
document.getElementById("rname").value = "";
document.getElementById("displayarea3").innerHTML = document.getElementById("kname").value;
document.getElementById("kname").value = "";
document.getElementById("displayarea4").innerHTML = document.getElementById("hname").value;
document.getElementById("hname").value = "";
document.getElementById("displayarea5").innerHTML = document.getElementById("oname").value;
document.getElementById("oname").value = "";
}
</script>
<link href="general.css" rel="stylesheet" />
</head>
<body>
<header>
<nav class="horizontal">
<ul>
<li>Sitemap</li>
<li>Quiz page 1</li>
</ul>
</nav>
<article>
<h1>Goal Setting</h1>
<p></p>
</article>
</header>
<table bgcolor="#FF00FF" border="1" align="center">
<tr>
<td>Goal</td>
<td><input type="text" name="fname" id="fname"></td>
</tr>
<tr>
<td>Plan</td>
<td><input type="text" name=pname" id="pname"></td>
</tr>
<tr>
<td>Goal</td>
<td><input type="text" name="rname" id="rname"></td>
</tr>
<tr>
<td>Plan</td>
<td><input type="text" name=kname" id="kname"></td>
</tr>
<tr>
<td>Goal</td>
<td><input type="text" name="hname" id="hname"></td>
</tr>
<tr>
<td>Plan</td>
<td><input type="text" name=oname" id="oname"></td>
</tr>
<tr>
<td> </td>
<td align="center"><input type="button" value="Submit" name="submit" id="submit" onClick="display(event)" /></td>
</tr>
</table>
<table width="400px" align="center" border=0>
<tr style="background-color:#8FBC8F;">
<td align="center"><b>Goal</b></td>
<td align="center"><b>Plan</b></td>
<td align="center"><b>Goal</b></td>
<td align="center"><b>Plan</b></td>
<td align="center"><b>Goal</b></td>
<td align="center"><b>Plan</b></td>
</tr>
<tr>
<td align="center">
<div id="displayarea"></div>
</td>
<td align="center">
<div id="displayarea1"></div>
</td>
<td align="center">
<div id="displayarea2"></div>
</td>
<td align="center">
<div id="displayarea3"></div>
</td>
<td align="center">
<div id="displayarea4"></div>
</td>
<td align="center">
<div id="displayarea5"></div>
</td>
</tr>
</table>
<footer></footer>
</body>
</html>
So bottom pic is what it looks like right now, it shares the same opacity as the background but I only want the background to have it, not the content. The above pic is what another page looks like, I want it to look like that.
#jackie, it's not making everything transparent, but the image is actually above your page content, thus making it look opaque as well. Your solution is to set z-index of ::after pseudoelement to -1.
div::after {
min-height: 100%;
min-width: 1024px;
pointer-events: none;
width: 100%;
height: auto;
top: 0;
left: 0;
content: "";
display: block;
position: fixed;
background: url(brain.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
opacity: 0.1;
z-index: -1;
}
But like I said in the comment, I would highly suggest that you target very specific element with a class on it, instead of applying ::after to every directly to div element.
I'm stuck with a problem. I need to print the page with the logo but the problem is that the logo is shown in the browser but in the print preview (CTRL P) the logo is not displayed.
For any guidance I would be very thankful.
This is the html code and css media print code
/* ## removed here since they are specific to ASP.NET MVC */
#media print {
#page {
size: A4 landscape;
max-height: 100%;
max-width: 100%;
position: fixed;
}
.prints {
height: 19.2cm;
page-break-after: avoid;
border: black 1px solid;
}
.row {
page-break-after: avoid;
}
}
/*! Generated by Font Squirrel (https://www.fontsquirrel.com) on July 30, 2018 */
label {
font: c
}
<table align="center" style="padding-left:10px;">
<tbody>
<tr>
<td colspan="3">
<h4 style="text-align:center;padding-left:25px; font-family:Calibri"><b> CHALLAN FORM </b></h4>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td>
<div>
<label style="padding-left:10px;width:145px;">
<span style="line-height:1; width: 135px; font-size:26px; font-family:'Chursaechsische Fraktur';"><strong>Baitul Huda</strong></span>
<span style="line-height:1;border:0px; width:100px; font-size:12px; font-family:'Adobe Devanagari';">High School For Girls</span>
</label>
</div>
</td>
<td rowspan="2" style="width:30px;padding-right:0px; padding-left: 10px;">
<img src="~/images/nku_02.png" height="70" width="70" alt="Bail ul huda logo" />
</td>
<td style="padding-left:10px;">
<div style="padding-left:5px;">
<label style="width:120px;padding-top:0px;padding-bottom:0px;">
<span style="line-height:0; width: 160px; font-size:26px; font-family:'UL Sajid Heading';">بیت الھدیٰ</span>
<span style="line-height:1; width:100px;padding-left:10px; font-size:16px; font-family:'Al Qalam Quran 2A';"> ھایئ سکول فارگرلز</span>
</label>
</div>
</td>
</tr>
</tbody>
</table>
I Found the solution
Img is not coming in print view because there is a missing of a div
<td rowspan="2">
<div style="padding-left:10px;width:80px;height:50px">
<img src="/images/offical_Logo_Baitul_Huda.jpeg" class="img-responsive" style="height:50px ; width:100px" alt="">
</div>
</td>
As i add the div the logo start displayed in print view
I'm trying to find a solution to laying out forms in our app (ported from Silverlight). We like labels to up, are trying to do this without tables, but there's a fundamental problem that tables solve I'm not sure how to address any other way.
Here is an example (plnkr):
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
font-size: 1.1rem;
border-bottom: 1px solid #ccc;
}
td {
vertical-align: top;
padding-bottom: 0.5rem;
}
</style>
</head>
<body>
<table>
<tr>
<td colspan='2'><h1>This is a header that should span columns.</h1></td>
</tr>
<tr>
<td>
label:
<div>(This label is extra</div>
<div>tall because of these</div>
<div> extra lines.)</div>
</td>
<td><input placeholder='search for stuff'></td>
</tr>
<tr>
<td>this is the longest label:</td>
<td><input placeholder='search for stuff'>
<div>This content is extra tall.</div>
</td>
</tr>
<tr>
<td>longer label:</td>
<td><input placeholder='search for stuff'></td>
</tr>
<tr>
<td colspan='2' class='my-header-style'><h1>This is a header that should span columns.</h1></td>
</tr>
<tr>
<td>long label:</td>
<td><input placeholder='search for stuff'></td>
</tr>
<tr>
<td>another label:</td>
<td>
<div>This content is extra tall.</div>
<div>This content is extra tall.</div>
<div>This content is extra tall.</div>
</td>
</tr>
<tr>
<td>short label:</td>
<td><input placeholder='search for stuff'></td>
</tr>
</table>
</body>
</html>
We have two groups of "label: input" lists, each with their own headings. The leftmost-column adjusts to the width of the widest label in either group, and simultaneously each row also adjust to the height of the tallest element.
How do I achieve this same behavior without tables? When people are talking about "tableless" layout, is that only for things that don't care about content size for their layout?
EDIT:
Uh, sorry. You actually can do more than two elements per line, but (as usual with float: right) you have to put them in reverse order.
If you must not use a table: Add a div for each row and put a invisible horizontal rule between them to keep them from piling onto each other. Also: a float: left to the labels and a float: right to the input boxes. It works, but I would not know how to make a line with three or more elements, like: Born on: Month/Day/Year, work.
Anyway, here is how you can do it.
<!DOCTYPE=html>
<html>
<style>
* {
margin: 0;
padding: 0;
}
body {
float: left;
}
hr {
clear: both;
border: none;
}
p{
float: left;
}
form {
float: right;
}
</style>
<body>
<div id = "row_1">
<p>looooooooooooo <br /> ooooooooooooo <br /> ooong label: </p>
<form><input type="text" placeholder="Second" /></form>
</div>
<hr />
<div id = "row_2">
<p>short</p>
<form><input type="text" placeholder="First" /></form>
</div>
</body>
</html>
I've built a site with tons of pages and have used tables because I am new to coding and they're easy to use. I used Chrome to do all of my testing and stuff but I've recently found that Internet Explorer doesn't show certain table elements like border colours and my tables barely work at all with Firefox.
My PROBLEM is that my entire site is laid out using tables, this one specific example below is correct to use a table yes but it's just an example to show how I code my tables.
I've been looking at CSS for hours now, trying various tutorials/guides but I can't get my head around it, every time I get somewhere something happens and I have to start from scratch.
Right, scratch what I put before. Here's 2 screenshots. The one that looks fine is Google Chrome, the other is Firefox:
Now here's the code:
<style>
table.fix{
table-layout: fixed;
font-size: 90%;
}
</style>
<table BORDERCOLOR="grey" style="width: 60%;" align="left" class="fix">
<tr>
<td><?php echo "<b>Subject: ",$subject,"</b>"; ?></td>
</tr>
</table>
<table BORDERCOLOR="grey" style="width: 40%;" align="right" class="fix">
<tr>
<td><?php echo $datesent; ?></td>
</tr>
</table>
<table BORDERCOLOR="grey" style="width: 100%;"class="fix">
<tr>
<td><?php echo $message; ?></td>
</tr>
</table>
<table BORDERCOLOR="grey" align="left" class="fix">
<tr>
<td><?php echo "From: <a href='viewprofile.php?userid=$fromuser'>",$id2," </a>"; ?></td>
</tr>
</table>
<table class="fix">
<tr>
<td><input type='submit' name='reply' value='Reply' onclick="location.href='sendmail.php?user=<?php echo $fromuser; ?>&subject2=<?php echo $subject; ?>&replyto=<?php echo $id; ?>'"></td>
</tr>
</table>
Now all I need is it to look like it does on Chrome but on every browser :) Whether it's through CSS, tables whatever I don't care, as long as it works and you guys would recommend the method
EDIT- Don't know how but I got the hang of it, it's now working with the code below :)
<style>
table.fix{
table-layout: fixed;
font-size: 90%;
}
.template{
border-style: solid;
border-color: grey;
height: 25px;
}
.left {
float: left;
}
.right {
float: right;
}
.box{
width: 530px;
height: 150px;
border-style: solid;
border-color: grey;
font-size: 90%;
}
.namebox{
border-style: solid;
border-color: grey;
}
<div style="width: 300px;" class="template left"><?php echo "<b>Subject: ",$subject,"</b>"; ?></div>
<div style="width: 223px;" class="template right"><?php echo $datesent; ?></div>
<div class="box"><?php echo $message; ?></div>
<div class="namebox"><?php echo "From: <a href='viewprofile.php?userid=$fromuser'>",$id2,"</a>"; ?></div>
<br /><center><input type='submit' name='reply' value='Reply' onclick="location.href='sendmail.php?user=<?php echo $fromuser; ?>&subject2=<?php echo $subject; ?>&replyto=<?php echo $id; ?>'" /></center>
If you want to use divs, you need to specify the class of a div.
<div>
<div>
<div class="head">Cost Per Shard</div>
<div class="head">Use</div>
<div class="head">How many shards?</div>
</div>
<div>
<div class="cont">1000 Gems</div>
<div class="cont">VIP Resource</div>
<div class="cont"><input type="text" name="gems2" /></div>
</div>
<div>
<div class="cont"></div>
<div class="cont"></div>
<div class="cont"><input type="submit" name="Trade2" value="Trade"/></div>
</div>
Then you must specify the classes:
.head
{
width: 33%;
display: inline-block;
color: orange;
font-weight: bold;
}
.cont
{
width: 33%;
display: inline-block;
color: white;
}
your CSS:
.text
{
style="color:white;
font-size: 0.8em";
}
.tablehead
{
color: orange;
font-weight: bold;
}
.teabledata
{
color: white;
}
your HTML
<form action="gemshop.php" method="post">
<table cellpadding="5" cellspacing="5">
<p class="text">Buy Shards</p>
<tr>
<td class="tablehead">Cost Per Shard</td>
<td class="tablehead">Use</td>
<td class="tablehead">How many shards?</td>
</tr>
<tr>
<td class="tablehead">1000 Gems</td>
<td class="tablehead">VIP Resource</td>
<td><input type="text" name="gems2" /></td>
</tr>
</tr>
<tr>
<td></td>
<td></td>
<td><input type="submit" name="Trade2" value="Trade"/></td>
</tr>
Hopes this answers your question...