In my css file I have the following code and want it to applied on caption of my table
caption
{
color:green;
font-style:bold;
}
my html file
<html> <head>
<link href="mystyles.css" rel="stylesheet" type="text/css" />
<title>Home Page - My Schedule</title> </head> <body>
<center> <h2>write your name here...</h2>
Home Page My CV My Schedule My Courses Banner Links Frames
<br/> <table border="1" width="800" height="300" align="center"> <caption><h3>My Schedule</h3></caption>
<br/> <thead> <tr align="center"> <td><img src="img3.jpg" alt="" width="200" height="280"></td> <td colspan="4"><center><h4>write your name here - level 4</h4> </td> </tr> </thead> <tr align="center"> <td>1</td> <td>Web Design</td> <td bgcolor="#C0C0C0" >Off</td> <td colspan="2">management</td> </tr> <tr align="center"> <td>2</td> <td>management</td> <td bgcolor="#C0C0C0" colspan="3">Off</td> </tr> <tr align="center"> <td>3</td> <td bgcolor="#C0C0C0">Off</td> <td >management</td> <td colspan="3">management</td> </tr> <tr align="center"> <td>4</td> <td>Web Design</td> <td>management</td> <td>math</td> <td bgcolor="#C0C0C0">Off</td> </tr> <tr align="center"> <td>5</td> <td bgcolor="#C0C0C0" colspan="4">Off</td> </tr> </table>
Go Back </center> </body> </html>
but the problem is that code working fine on IE but not working on Firefox and Chrome. I tried to clear cache but nothing help.
Secondly, I have my website in the following path
C:\Users\user\Desktop\My Website
and my css file in the following path
C:\Users\user\Desktop\My Website\styles
and I am not able to link css file when its in this subfolder
I tried the following code
<link href="../mystyles.css" rel="stylesheet" type="text/css" />
<link href="../styles/mystyles.css" rel="stylesheet" type="text/css" />
but not working.
Replace
<link href="mystyles.css" rel="stylesheet" type="text/css" />
With
<link href="styles/mystyles.css" rel="stylesheet" type="text/css">
You haven't told your HTML file that the mystyles.css file is in the styles folder.
FYI..
<link href="../mystyles.css" rel="stylesheet" type="text/css" />
Would be C:\Users\user\Desktop\mystles.css
and
<link href="../styles/mystyles.css" rel="stylesheet" type="text/css" />
Would be C:\Users\user\Desktop\styles\mystles.css
Related
I have the following syntax in my _Layout.cshtml:
<head>
<meta name="viewport" content="width=device-width" />
<title>#ViewBag.Title</title>
<link href="~/lib/datatables/css/dataTables.bootstrap4.css" rel="stylesheet" />
<link href="~/lib/font-awesome/css/all.css" rel="stylesheet" />
<link href="~/lib/jqueryui/jquery-ui.css" rel="stylesheet" />
<script src="~/lib/tinymce/tinymce.min.js"></script>
<link href="~/content/site.css" rel="stylesheet" />
</head>
I can see the ~/content/site.css in the Page Source but the styles isn't being applied. The site.css only has one entry as follows:
.table-hover tbody tr:hover td {
background: #48b9e5;
}
If I manually add the style to my Razor Page via the tag it works just fine. What am I missing?
--- Val
Here is a demo:
Tasks.cshtml(You need to put css between <style></style>):
<table class="table table-hover">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td>john#example.com</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td>mary#example.com</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
<td>july#example.com</td>
</tr>
</tbody>
</table>
Here is my _Layout.cshtml:
Here is html of Tasks.cshtml:
Here is Network of Tasks.cshtml:
result:
it seems that css file can't override styles used in bootstrap or other liberary
try this background: #48b9e5 !important;
How to fit table on mobile view?
I want:
But it is as:
My codes:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<h2>Text:</h2>
<table class="table table-bordered table-dark">
<tbody>
<tr>
<td>Name</td>
<td>Text</td>
</tr>
<tr>
<td>Text</td>
<td>Text</td>
</tr>
<tr>
<td>Text</td>
<td>Text text text text text</td>
</tr>
<tr>
<td>Text</td>
<td>Text</td>
</tr>
</tbody>
</table>
SelectGo Ahead
</div>
How to fit table on mobile view?
The result for the above codes is not readable properly, we have to zoom it!
You can change from <div class="container"> to <div class="container-fluid">
And add meta viewport for your page.
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
Here is result with container-fluid
If you don't want to use container-fluid, you can setup in media query max width 767px, remove max-width values and set margin to 0 for container class
Yes, almost everyone hates creating emails in Outlook (Android is almost as bad with Gmail and such). But, most of us are whingeing about getting rid of borders and I am whingeing about a border that does not want to work in Outlook '07, '10 & '13 (the usual suspects). Here is the code. It works everywhere...perfectly. Beautifully. Exquisitely. I have seen no one deal with a missing border. Can you help me, please...Godfather?
<table bgcolor="#ffffff" width="594" border="3" align="center" cellpadding="0" cellspacing="0" style="box-sizing: border-box; border: #b29d6c 3px solid;" class="deviceWidth">
Without knowing the entirety of your code, I cannot give you any other suggestions but will provide some proof that the code I am providing (see below) should work for the Outlook version that you are experiencing issues with.
Outlook 2007
http://i.imgur.com/tbVafPl.png
Outlook 2011
http://i.imgur.com/W1tvXSk.png
Outlook 2013
http://i.imgur.com/PvLAj3T.png
I have tested the code that you have provide. Here is a sample code that I put together that include your code at the very top. Notice that in all of the screen grabs above, setting your border properties does in fact work. There could be other issues within the entirety of your HTML.
Sample Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!--[if !mso]><!-->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!--<![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="margin: 0px;outline: none;padding: 0px;width: 100%;background-color: #EFEFEF;background: #EFEFEF;">
<div style="margin: 0px;outline: none;padding: 0px;width: 100%;background-color: #EFEFEF;background: #EFEFEF;font-family:arial,sans;font-size:15px;color:#555555;text-align: center;">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top" width="100%" style="font-family:arial,sans;font-size:15px;color:#555555;mso-table-lspace:0pt;mso-table-rspace:0pt;">
<table border="0" cellpadding="0" cellspacing="0" width="650" bgcolor="#EFEFEF" style="min-width: 650px;font-family:arial,sans;font-size:15px;color:#555555;">
<tr>
<td width="650" valign="top" align="left" style="padding:50px;background-color: #ffffff;font-family:arial,sans;font-size:15px;color:#555555;text-align:left;line-height:150px;line-height:1.5;mso-table-lspace:0pt;mso-table-rspace:0pt;">
<table border="0" cellpadding="0" cellspacing="0" width="650" bgcolor="#ffffff" border="3" style="border: #b29d6c 3px solid;min-width: 650px;font-family:arial,sans;font-size:15px;color:#555555;">
<tr>
<td width="650" valign="top" align="center" style="padding:50px;background-color: #ffffff;font-family:arial,sans;font-size:15px;color:#555555;text-align:center;line-height:150px;line-height:1.5;mso-table-lspace:0pt;mso-table-rspace:0pt;">
This example sets the border styling on the table tag, not the table cell
</td>
</tr>
</table>
<br><br><br><br>
<table border="0" cellpadding="0" cellspacing="0" width="650" bgcolor="#FFFFFF" style="min-width: 650px;font-family:arial,sans;font-size:15px;color:#555555;">
<tr>
<td width="650" valign="top" align="center" style="border: #b29d6c 3px solid;padding:50px;background-color: #ffffff;font-family:arial,sans;font-size:15px;color:#555555;text-align:center;line-height:150px;line-height:1.5;mso-table-lspace:0pt;mso-table-rspace:0pt;">
Has the CSS border properties set on the table cell
</td>
</tr>
</table>
<br><br><br><br>
<table border="0" cellpadding="0" cellspacing="0" width="650" bgcolor="#FFFFFF" style="min-width: 650px;font-family:arial,sans;font-size:15px;color:#555555;">
<tr>
<td width="100%" valign="top" align="center" style="background-color:#b29d6c;padding:3px;">
<table border="0" cellpadding="0" cellspacing="0" width="650" bgcolor="#EFEFEF" style="min-width: 650px;font-family:arial,sans;font-size:15px;color:#555555;">
<tr>
<td width="100%" valign="top" align="center" style="padding:50px;background-color: #ffffff;font-family:arial,sans;font-size:15px;color:#555555;text-align:center;line-height:150px;line-height:1.5;mso-table-lspace:0pt;mso-table-rspace:0pt;">
This technique uses an outter table with the background color of the border and a padding set to 3 pixel to mimic the borders around the text block.
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
I'm testing a local site in my phone (Lumia 920), the Bootstrap 3 site shows OK, but when I access to my local site my table doesn't look responsive.
I even tried with the sample code of the Bootstrap page..
Here is my code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 101 Template</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body data-twttr-rendered="true">
<div class="container">
<div class="row">
<div class="col-md-9">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th></th>
<th>
Extra small devices
<small>Phones (<768px)</small>
</th>
<th>
Small devices
<small>Tablets (≥768px)</small>
</th>
<th>
Medium devices
<small>Desktops (≥992px)</small>
</th>
<th>
Large devices
<small>Desktops (≥1200px)</small>
</th>
</tr>
</thead>
<tbody>
<tr>
<th class="text-nowrap">Grid behavior</th>
<td>Horizontal at all times</td>
<td colspan="3">Collapsed to start, horizontal above breakpoints</td>
</tr>
<tr>
<th class="text-nowrap">Container width</th>
<td>None (auto)</td>
<td>750px</td>
<td>970px</td>
<td>1170px</td>
</tr>
<tr>
<th class="text-nowrap">Class prefix</th>
<td><code>.col-xs-</code></td>
<td><code>.col-sm-</code></td>
<td><code>.col-md-</code></td>
<td><code>.col-lg-</code></td>
</tr>
<tr>
<th class="text-nowrap"># of columns</th>
<td colspan="4">12</td>
</tr>
<tr>
<th class="text-nowrap">Column width</th>
<td class="text-muted">Auto</td>
<td>~62px</td>
<td>~81px</td>
<td>~97px</td>
</tr>
<tr>
<th class="text-nowrap">Gutter width</th>
<td colspan="4">30px (15px on each side of a column)</td>
</tr>
<tr>
<th class="text-nowrap">Nestable</th>
<td colspan="4">Yes</td>
</tr>
<tr>
<th class="text-nowrap">Offsets</th>
<td colspan="4">Yes</td>
</tr>
<tr>
<th class="text-nowrap">Column ordering</th>
<td colspan="4">Yes</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-3">
asd
</div>
</div>
</div>
</body>
</html>
What am I doing wrong?.
Thank you.
Since IE10 on WP8 has some bugs regarding its processing of <meta name="viewport" content="width=device-width">, you need to apply the WP8 IE10-specific hack detailed in the Bootstrap documentation:
Add this CSS:
#-webkit-viewport { width: device-width; }
#-moz-viewport { width: device-width; }
#-ms-viewport { width: device-width; }
#-o-viewport { width: device-width; }
#viewport { width: device-width; }
And this JavaScript:
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement('style');
msViewportStyle.appendChild(
document.createTextNode(
'#-ms-viewport{width:auto!important}'
)
);
document.querySelector('head').appendChild(msViewportStyle)
}
Or you can wait for Windows Phone 8.1, where the bug is said to be fixed.
I'm trying to add jquery data tables to a simple aspx page. Did this before a couple times but this website that I'm adding it to now has some CSS that is getting inherited.
So I took the generated HTML and removed the CSS that was getting added to it.
My page still does not style properly!
Here is my HTML.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="Scripts/jquery-1.10.2.js"></script>
<script type="text/javascript" src="Scripts/jquery-ui-1.10.3.custom.min.js"></script>
</head>
<body>
<div>
<script type="text/javascript" src="Scripts/jquery-1.10.2.js"></script>
<script type="text/javascript" src="Scripts/jquery-ui-1.10.3.custom.min.js"></script>
<script type="text/javascript" src="Scripts/jquery.dataTables.min.js"></script>
<link href="CSS/jquery-ui-1.10.3.custom.css" rel="stylesheet" />
<link href="CSS/demo_page.css" rel="stylesheet" />
<link href="CSS/demo_table.css" rel="stylesheet" />
<link href="CSS/demo_table_jui.css" rel="stylesheet" />
<link href="CSS/jquery.dataTables.css" rel="stylesheet" />
<link href="CSS/jquery.dataTables_themeroller.css" rel="stylesheet" />
<script type="text/javascript">
$(document).ready(function () {
$("#gvMain").prepend($("<thead></thead>").append($(this).find("tr:first"))).
dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers"
});
});
</script>
<div>
<form>
<table id="gvMain">
<tr>
<th scope="col">Some Id</th>
</tr>
<tr class="gridItem">
<td>297</td>
</tr>
<tr class="gridAlternatingItem">
<td>296</td>
</tr>
<tr class="gridItem">
<td>295</td>
</tr>
<tr class="gridAlternatingItem">
<td>295</td>
</tr>
<tr class="gridItem">
<td>294</td>
</tr>
<tr class="gridAlternatingItem">
<td>294</td>
</tr>
<tr class="gridItem">
<td>293</td>
</tr>
<tr class="gridAlternatingItem">
<td>293</td>
</tr>
</table>
</div>
</form>
</div>
</body>
</html>
It looks like below
I have spent hours trying to get it to work but no luck. It is in the main directory of the existing site though. But that should not matter right coz the HTML does not have anything included in it.
This is the screenshot of four errors that are showing in the above screenshot. It is nothing but some missing images/css files.
You have to add the <thead> and <tbody> tag
Here is example of table:
<table id="gvMain">
<thead>
<tr>
<th scope="col">Some Id</th>
</tr>
</thead>
<tbody>
<tr class="gridItem">
<td>297</td>
</tr>
<tr class="gridAlternatingItem">
<td>296</td>
</tr>
<tr class="gridItem">
<td>295</td>
</tr>
<tr class="gridAlternatingItem">
<td>295</td>
</tr>
<tr class="gridItem">
<td>294</td>
</tr>
<tr class="gridAlternatingItem">
<td>294</td>
</tr>
<tr class="gridItem">
<td>293</td>
</tr>
<tr class="gridAlternatingItem">
<td>293</td>
</tr>
</tbody>
</table>