remove client table spacing between rows - html

I have the following table:
For some reason, When I render this there is an enormous space between each row! I have searched everywhere and I just don't know how to eliminate the space. I tried manually setting the height of each row but that still did not prove useful, the default huge space overrides everything i throw at it. Any suggestions?
<table style="display:block;">
<tr>
<td class="auto-style1"><p>תעודת זהות</p></td>
<td><telerik:RadTextBox runat="server" id="txtId" Skin="Metro"/></td>
</tr>
<tr>
<td class="auto-style1"><p>סיסמא</p></td>
<td>
<telerik:RadTextBox ID="txtPassword" runat="server" Skin="Metro" />
</td>
</tr>
<tr>
<td class="auto-style1"><p>שם פרטי</p></td>
<td>
<telerik:RadTextBox ID="txtfName" runat="server" Skin="Metro" />
</td>
</tr>
<tr>
<td class="auto-style1"><p>שם משפחה</p></td>
<td>
<telerik:RadTextBox ID="txtlName" runat="server" Skin="Metro" />
</td>
</tr>
<tr>
<td class="auto-style1"><p>מספר טלפון</p></td>
<td>
<telerik:RadTextBox ID="txtmPhone" runat="server" Skin="Metro" />
</td>
</tr>
<tr>
<td class="auto-style1"><p>כתובת</p></td>
<td>
<telerik:RadTextBox ID="txtAddress" runat="server" Skin="Metro" />
</td>
</tr>
<tr>
<td class="auto-style1"><p>אימייל</p></td>
<td>
<telerik:RadTextBox ID="txtEmail" runat="server" Skin="Metro" />
</td>
</tr>
</table>
style:
<style type="text/css">
.auto-style1 {
width: 126px;
}
table tr td p {
font-family: Arial;
}
</style>
NOTE: In the design view of visual studio there is no spacing, it looks fine. only when rendering it comes out this way.

Try
<style type="text/css">
tr, td, p {
margin: 0px;
padding: 0px;
}
</style>`

A table always has a padding. So add to your CSS padding: 0;
<style type="text/css">
.auto-style1 {
width: 126px;
}
table tr td p {
font-family: Arial;
padding: 0;
}
</style>

Related

How to change position of a specfic <td> element inside a HTML table

So, I have this table in which I need to place the td that contains the profile info further to the right as following:
Example
this is my HTML:
<table>
<tr>
<td>
<asp:Label ID="****" runat="server" CssClass="FieldLabelRqrd" Text="Name"></asp:Label>
</td>
<td>
<asp:Label ID="***" runat="server" Text="ID=****"></asp:Label>
</td>
<td colspan="4">
<div id="cssProfile">
<asp:Label ID="lblProfile" runat="server" Text="Profile:" CssClass="lblProfile"></asp:Label>
<asp:HyperLink ID="hlGoProfile" runat="server" ForeColor="blue" Target="_blank" CssClass="hlGoProfile" Text="Go"></asp:HyperLink>
</div>
</td>
</tr>
</table>
I tried colspan and rowspan but this does no work and here's the CSS
#cssProfile{
display:flex;
justify-content: start-flex;}
.lblProfile{
margin-left: auto;}
.hlGoProfile{
margin-left: auto;}
Give your table 100% width and add text-align: right to the cell in question.
BTW, you could remove that colspan, if you don't need it for any other purpose.
table {
width: 100%;
}
#cssProfile {
border: 1px solid red;
text-align: right;
}
<table>
<tr>
<td>
<asp:Label ID="****" runat="server" CssClass="FieldLabelRqrd" Text="Name">A</asp:Label>
</td>
<td>
<asp:Label ID="***" runat="server" Text="ID=****">B</asp:Label>
</td>
<td colspan="4">
<div id="cssProfile">
<asp:Label ID="lblProfile" runat="server" Text="Profile:" CssClass="lblProfile">C</asp:Label>
<asp:HyperLink ID="hlGoProfile" runat="server" ForeColor="blue" Target="_blank" CssClass="hlGoProfile" Text="Go">D</asp:HyperLink>
</div>
</td>
</tr>
</table>

Keeping size fixed even If td has large content inside it

In the Calendar Widget for the fourth row there is large text so its not fitting in single line so its size is increasing & View All button is also overlapping the edge of the widget. the number of row is fixed that means it can show maximum 5 rows at a time but the content of each row may have larger text. so when its not fitting in single line its giving me the trouble. i have tried few css trick but did not work. i need help to fix the size of its content so the designs works well.I am dot net developer but not a designer so not so much expert with css design. Please help me .
This is my aspx Code.
<table style="border: 0px; width: 500px;">
<tr>
<td style="width: 55px;"><img alt="" src="/Images/DeptIcons/Administration.png" /></td>
<td class="deptHeader">Calendar Editor</td>
</tr>
</table>
<hr style="border-top: 1px solid #79767b; margin-bottom: 20px;" />
<div style="position: relative;"><img alt="" src="/Images/ctnrTop.png" /></div>
<div style="background-image: url('/Images/ctnrBG.gif'); position: relative; margin-top: -5px; padding: 15px 0px 0px 15px;" class="cntrFont">
<table width="927" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
<tr>
<td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnRebind" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Button UseSubmitBehavior="false" ID="btnRebind" runat="server" Style="display: none; width: 0px; height: 0px;
border: none; font-size: 0px; line-height: 0px;" OnClick="btnRebind_Click" />
<table cellpadding="4" cellspacing="0">
<tr>
<td colspan="4" align="right"><input type="button" onclick="addResult()" value="Add Calendar Event" class="fancyButton" /></td>
</tr>
<tr>
<td style="width: 30px; text-align: center;"></td>
<td style="width: 180px;"><b>Event Name</b></td>
<td style="width: 160px;"><b>Event Date</b></td>
<td></td>
</tr>
<asp:Repeater ID="rptEvents" runat="server">
<ItemTemplate>
<tr>
<td style="width: 30px; text-align: center;"><img src="../Images/icoStar.png" style="width: 15px; height: 15px; margin-top: 4px;" alt="Event" /></td>
<td><a class="calendarName" href="javascript:void(0);" onclick='showSearchResult(<%#Eval("CalID")%>,1);'><%# DataBinder.Eval(Container.DataItem, "calEvent")%></a></td>
<td><%# Convert.ToDateTime(Eval("calEventDate").ToString()).ToString("MMMM dd yyyy") %></td>
<td></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</td>
</tr>
</table>
</div>
<table style="border: 0px; width: 500px;">
<tr>
<td style="width: 55px;"><img alt="" src="/Images/DeptIcons/Administration.png" /></td>
<td class="deptHeader">Calendar Editor</td>
</tr>
</table>
<hr style="border-top: 1px solid #79767b; margin-bottom: 20px;" />
<div style="position: relative;"><img alt="" src="/Images/ctnrTop.png" /></div>
<div style="background-image: url('/Images/ctnrBG.gif'); position: relative; margin-top: -5px; padding: 15px 0px 0px 15px;" class="cntrFont">
<table width="927" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
<tr>
<td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnRebind" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Button UseSubmitBehavior="false" ID="btnRebind" runat="server" Style="display: none; width: 0px; height: 0px;
border: none; font-size: 0px; line-height: 0px;" OnClick="btnRebind_Click" />
<table cellpadding="4" cellspacing="0">
<tr>
<td colspan="4" align="right"><input type="button" onclick="addResult()" value="Add Calendar Event" class="fancyButton" /></td>
</tr>
<tr>
<td style="width: 30px; text-align: center;"></td>
<td style="width: 180px;"><b>Event Name</b></td>
<td style="width: 160px;"><b>Event Date</b></td>
<td></td>
</tr>
<asp:Repeater ID="rptEvents" runat="server">
<ItemTemplate>
<tr>
<td style="width: 30px; text-align: center;"><img src="../Images/icoStar.png" style="width: 15px; height: 15px; margin-top: 4px;" alt="Event" /></td>
<td> <div title="<%# DataBinder.Eval(Container.DataItem, "calEvent")%>" style="width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis"><a class="calendarName" href="javascript:void(0);" onclick='showSearchResult(<%#Eval("CalID")%>,1);'><%# DataBinder.Eval(Container.DataItem, "calEvent")%></a></div></td>
<td><%# Convert.ToDateTime(Eval("calEventDate").ToString()).ToString("MMMM dd yyyy") %></td>
<td></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</td>
</tr>
</table>
</div>
You may want to take a look at combining the text-overflow: ellipsis css rule with overflow: hidden. For this to work, the cell must also have a fixed width, and the whitespace: nowrap tells it not to wrap long text. This will show there's more text, and you can set the cell title to the full text content so a mouseover will hint the name of the entry. Please use external css files. I just put this inline as an example.
<asp:Repeater ID="rptEvents" runat="server">
<ItemTemplate>
<tr>
<td style="width: 30px; text-align: center;"><img src="../Images/icoStar.png" style="width: 15px; height: 15px; margin-top: 4px;" alt="Event" /></td>
<td title="<%# DataBinder.Eval(Container.DataItem, "calEvent")%>" style="width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis"><a class="calendarName" href="javascript:void(0);" onclick='showSearchResult(<%#Eval("CalID")%>,1);'><%# DataBinder.Eval(Container.DataItem, "calEvent")%></a></td>
<td><%# Convert.ToDateTime(Eval("calEventDate").ToString()).ToString("MMMM dd yyyy") %></td>
<td></td>
</tr>
</ItemTemplate>
</asp:Repeater>
EDIT: Sorry, My mistake... those css rules won't apply to a <td>. You may want to start considering dropping tables entirely in favour of <div>s, or insert a <div> into the cell, like below:
table {
width: 100%;
border-collapse: collapse;
border-spacing: 0;
}
td {
padding: 5px;
border: 1px solid;
margin: 0;
}
td:first-of-type {
width: 30px;
}
.event-name {
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"/>
</head>
<body>
<table>
<tr>
<td><i class="fa fa-star"></i></td>
<td><div title="This is a very loooooooong text! There can be nothing longer than it" class="event-name">This is a very loooooooong text! There can be nothing longer than it</div></td>
<td>Friday, August 19, 2016</td>
<td></td>
</tr>
</table>
</body>
</html>

Using z-index in a table cell to write over an image

I want to place text on top of an image that I placed in a table cell.
I tried to use the z-index but the text keeps appearing under the image.
I created a class called p1 that positioned the image relative(not sure how I should handle this inside of a table) and the z-index -1.
I then added the class id in the table cell tag.
What I have so far:
.font1 {
font-family: Verdana, Geneva, sans-serif;
font-size: small;
text-align: left;
}
.hangingindent {
padding-left: 100px;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
}
.hangingindent2 {
padding-left: 75px;
}
.p1 {
position: relative;
z-index: -1;
}
.backbox {
z-index: -1;
position: relative;
left: 0;
right: 0;
botton: 0;
}
.text {
z-index 100;
color: #0000000;
font-size: 14px;
position: absolute;
top: 100px;
right: 200px;
overflow: hidden;
}
<table width="1013" border="0" align="center" cellpadding="0">
<tr>
<td colspan="5">
<img src="images/images2/header.gif" width="1013" height="642" />
</td>
</tr>
<tr>
<td colspan="5">
<img src="images/images2/menu-grid.gif" width="1013" height="232" />
</td>
</tr>
<tr>
<td width="55"> </td>
<td width="231">
<img src="images/images2/solutions.jpg" width="204" height="46" />
</td>
<td width="233">
<img src="images/images2/capabilities.jpg" width="204" height="46" />
</td>
<td width="232">
<img src="images/images2/art services.jpg" width="204" height="46" />
</td>
<td width="254">
<img src="images/images2/contact us.jpg" width="204" height="46" />
</td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="5" class="hangingindent2">
<img src="images/images2/WELCOME.gif" width="500" height="100" />
</td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="5" class="hangingindent">
<p>Since 1968, Packaging Products Corporation (PPC) has been a leader in the flexographic printing and converting industry.
<br />Our focus on emerging technologies in film substrates, ink systems, and controlled atmosphere packaging, enables us to
<br />provide the highest quality products at the most competitive prices.</p>
</td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="5">
<div class="backbox">
<img src="images/images2/bottom2.gif" width="1013" height="810" />
<div class="text">This is a test to see where the text will land</div>
</td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
</table>
As I got from your question is you want to put text over an image. So to do it, there is no need to use z-index. you can do it by setting absolute position of p tag and make td tag as position relative.
demo for it is you can use the link
<table>
<tr>
<td>
<p>Hello</p>
<img src="http://www.freakypic.in/wp-content/uploads/2014/08/flower-images.jpg" />
</td>
</tr>
</table>
CSS:
img {
width:200px;
}
td {
border:2px solid red;
position:relative;
}
p {
position:absolute;
color:yellow;
font-size:30px;
top:0px;
left:70px;
}
You can change the markup little bit.!Z-index will work with position set to other than static (which is default).
Here, you can remove the <img> tag & display the image as background image.
Other solution wrap the text in <p> or <div> & make it position: absolute & immediate parent <td> as position:relative (This is mentioned earlier already)
little code explanation
exp1 -- background-image
td {
background-image: url("");
background-position: left top fixed;
}
exp1 - HTML markup
<td>Data to be there on top of the image</td>
Please check this link! - JSFIDDLE

Center link text over image

I have an asp.net page that I'm trying to have an image be in the center of a table cell and have that image be a link to another page. I'm not too good with CSS but I tried a couple of different things and here's a screenshot of my outcome:
As you can see, the link is beside the image...I'd like to have that link be in the center of that image, but also have the image be clickable (as part of the link), like so:
Here's my table (keep in mind that this is part of a ASPx GridView control so it gets repeated for each row in it's datasource):
<table style="text-align: left; border-collapse: collapse; width: 100%">
<tr>
<td style="width: 5%;"><strong>Request ID</strong></td>
<td class="field">Date</td>
<td class="field">Requestor</td>
<td class="field">Status</td>
</tr>
<tr>
<td rowspan="4" align="center" style="position:relative;">
<%# Eval("RequestID") %>
</td>
<td>
<dx:ASPxLabel ID="labelRequestDate" runat="server" Text='<%# Eval("RequestDate") %>'></dx:ASPxLabel>
</td>
<td>
<dx:ASPxLabel ID="labelICAO" runat="server" Text='<%# Eval("ICAO") %>'></dx:ASPxLabel>
</td>
<td>
<dx:ASPxLabel ID="labelStatus" runat="server" Text='<%# Eval("Status") %>'></dx:ASPxLabel>
</td>
</tr>
<tr>
<td class="field" colspan="4">Summary</td>
</tr>
<tr>
<td colspan="4" valign="top">
<dx:ASPxLabel ID="labelSummary" runat="server" Text='<%# Eval("Summary") %>'></dx:ASPxLabel>
</td>
</tr>
<tr>
<td colspan="4">
<strong>Description:</strong>
<br />
<%# Eval("Description") %>
<br />
<br />
<strong>Comments</strong>
<br />
<%# Eval("Comments") %>
</td>
</tr>
</table>
The class "field" simply makes the text bold and sets the width to 10%.
Please keep in mind that I need this to work in IE7 and above, Chrome, and Firefox as well.
Any help is appreciated!
How about using a background image for a div tag which is wrapped around using an a tag?
Demo (You can remove border, just used it for test purpose)
<div><span>495</span></div>
div {
background-image: url('http://i.stack.imgur.com/aNy9C.jpg');
height: 90px;
width: 75px;
background-repeat: no-repeat;
border: 1px solid #f00;
position: relative;
}
div span {
position: absolute;
font-family: Arial;
font-size: 24px;
top:35%;
left: 20%;
}
a {
color: black;
}

I have trouble with CSS styling

i am trying to make my page looks like this :
Here is an album of what i've cut ...
https://plus.google.com/photos/107900027460905004143/albums/5701903548070918369?authkey=CNjam-nOwZzxSg
So, here is my CSS (sub table is the top part)
body
{
font-family : Segoe UI;
}
.main_table
{
width : 702px;
border:0px;
border-spacing:0px;
border-width:0px;
border-style:none;
border-collapse:collapse;
padding:0px;
}
.sub_table
{
background-image:url('../images/header_l.png');
background-repeat:no-repeat;
background-attachment:fixed;
width:47.5%;
}
.sub_table_r
{
background-image:url('../images/header_r.png');
background-repeat:no-repeat;
background-attachment:fixed;
width:47.5%;
}
.content_table
{
background-image:url('../images/content_left.png');
text-align:center;
background-attachment:scroll;
background-position:left;
width:47.5%;
}
.content_table_r
{
background-image:url('../images/content_right.png');
text-align:center;
background-attachment:scroll;
background-position:left;
width:47.5%;
}
.centre_col
{
background-image:url('../images/centre.png');
background-repeat:repeat-y;
width:5%;
background-position:center;
}
.centre_top
{
background-image:url('../images/top_centre.png');
background-repeat:no-repeat;
width:5%;
background-position:bottom;
}
.centre_bottom
{
background-image:url('../images/centre_bottom.png');
background-repeat:no-repeat;
width:5%;
background-position:top;
}
.Day
{
font-weight:bolder;
text-align:left;
font-size:large;
}
.Year
{
font-weight:bolder;
text-align:center;
font-size:large;
color:Orange;
}
.Week
{
font-weight:bold;
text-align:left;
font-size:large;
}
.Today
{
font-weight:bolder;
text-align:center;
font-size:x-large;
color:Navy;
vertical-align:middle;
}
.bottom
{
background-image:url("../images/bottom.png");
background-repeat:no-repeat;
background-position:top;
width:47.5%;
}
.bottom_r
{
background-image:url("../images/bottom_r.png");
background-repeat:no-repeat;
background-position:top;
width:47.5%;
}
and here is my HTML markup
<table class = "main_table">
<tr>
<td align="right" colspan="3">
<asp:Button ID="Button1" runat="server" Text="Create Events"
onclick="Button1_Click" />
</td>
</tr>
<tr>
<td align="right" class="sub_table">
<table >
<tr>
<td rowspan="4" class="Today">
</td>
<td rowspan="4" class="Today">
<br />
<asp:Label ID="Today" runat="server"></asp:Label>
</td>
<td class="Day">
<br />
<br />
</td>
</tr>
<tr>
<td class="Day">
<asp:Label ID="Month" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="Week">
<asp:Label ID="Week" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="Year">
<asp:Label ID="Year" runat="server"></asp:Label>
</td>
</tr>
</table>
</td>
<td class="centre_top">
</td>
<td align="left" class="sub_table_r">
<table>
<tr>
<td rowspan="4" class="Today">
</td>
<td rowspan="4" class="Today">
<asp:Label ID="Tomorrow" runat="server"></asp:Label>
</td>
<td class="Day">
<br />
<br />
</td>
</tr>
<tr>
<td class="Day">
<asp:Label ID="Month0" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="Week">
<asp:Label ID="Week0" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="Year">
<asp:Label ID="Year0" runat="server"></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="content_table" align="right">
<asp:Label ID="Content" runat="server" Width="300px"></asp:Label>
</td>
<td class="centre_col">
</td>
<td class="content_table_r">
<asp:Label ID="Content0" runat="server" Width="300px"></asp:Label>
</td>
</tr>
<tr>
<td class="bottom" align="right">
<br />
<br />
<br />
<br />
<br />
</td>
<td class="centre_bottom" align="center">
</td>
<td class="bottom_r">
</td>
</tr>
</table>
And this the output : (without content)
I really am baffled, and i think this problem had troubled me for a month . YOUR help is deeply appreciated .
I would not use tables. Use div and relative positioning. Use background images to get the notebook look.
Exactly as Ed Heal sad. Don't use tables. Use div or section with background-image + position relative and fix width and height. Then should it work.
Tables are always tricky to understand (cells, column, border, etc...).