Div with phantom left padding - css

I have a Div tag that for some reason is padding the left side with approx 50px.
The following is the html and mind you nono of the "class" have padding-left"
<body>
<div class="popHeaderMain" align="center">
<div class="PopHeader">
Keller Williams Realty | (704) 602-0271
</div>
<div class="popLoginHeader">
<table>
<tr>
<td style="font-size:10px;">Username: <input type="text" name="username" /></td>
<td style="font-size:10px;">Password: <input type="password" name="password" /></td>
<td style="vertical-align:bottom;"><input name="login" type="submit" value="Login" /></td>
</tr>
</table>
</div>
</div>
<!-- ImageReady Slices (backgroundPage.psd) -->
<div style="padding-top:20px; width:900px;" align="center">
<table id="Table_01" width="900" height="1200" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td rowspan="2" style="background-image:url(images/backgroundPage_01.png); background-repeat:no-repeat; width:20px; height:410px;">
<td rowspan="2" style="padding-top:8px; background-image:url(images/backgroundPage_02.png); background-repeat:no-repeat; height:380px; width:455px;">
<div style="padding-left:25px; padding-top:0px; font-family:Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold; color:#F0F0F0;">
Preview House Address
</div>
<div style="padding-top:20px; width:450px;">
<div style="padding-left:10px;">
<img src="images/GibsonHouse3.jpg" alt="GibsonHouse" border="0" style="width: 437px; height: 300px;"/>
</div>
</div>
</td>
<td style="padding-top:0px; background-image:url(images/backgroundPage_03.png); background-repeat:no-repeat; width:405px; height:58px;">
<div style="padding-top:0px; padding-left:50px; font-family:Georgia, 'Times New Roman', Times, serif; font-size:14px; heigh:58px;">Preview House 1 out of N of houses in area</div>
</td>
<td rowspan="2" style="background-image:url(images/backgroundPage_04.png); background-repeat:no-repeat; width:20px; height:410px;">
</tr>
<tr>
<td style="background-image:url(images/backgroundPage_05.png); background-repeat:no-repeat; width:405px; height:352px;"></td>
</tr>
<tr>
<td style="background-image:url(images/backgroundPage_06.png); background-repeat:no-repeat; width:20px; height:766px;"></td>
<td colspan="2" style="background-image:url(images/backgroundPage_07.png); background-repeat:no-repeat; width:860px; height:766px;"></td>
<td style="background-image:url(images/backgroundPage_08.png); background-repeat:no-repeat; width:20px; height:766px;"></td>
</tr>
<tr>
<td style="background-image:url(images/backgroundPage_09.png); background-repeat:no-repeat; width: 20px; height:24px;"></td>
<td colspan="2" style="background-image:url(images/backgroundPage_10.png); background-repeat:no-repeat; width:860px; height:24px;"></td>
<td style="background-image:url(images/backgroundPage_11.png); background-repeat:no-repeat; width:20px; height:24px;"></td>
</tr>
</table>
</div>
Can anyone help me please

The padding-left phantom was actually being inherited from the body tag. The width was set to 800px instead of 900px.

I don't see any anomalous left-padding. There is an empty cell on the left side of your table, 20px wide. Is that what you mean? Try temporarily changing the border attribute of the table to border="1" to get a better idea where the cells are.
For testing in Firefox, I would strongly recommend getting Firebug if you don't have it already. One of many benefits is that as you mouse over the elements in the HTML tab you'll see their padding highlighted.

Your body tag width is set to 800px. Change it to 900px. :)

Related

Three columns, mid column with absolute icon

I have done three columns with a mid column with an absolute icon on the side but the problem happens when you show it in the mobile or the screen is different that mine. If you resize screen the icon moves to the left.
The problem is that I used a position absolute for the icon, Is there no other way to do it?
I want to obtain this:
Codepen Code
table{
text-align:center;
margin-top:20px;
}
td{
padding: 20px;
}
#midCol{
background:lightblue;
width:90px;
}
#iconArrow{
color:red;
font-size:100px;
position: absolute;
top:140px;
right:985px;
}
.col1{
background:ghostwhite;
width:400px;
}
.col2{
background:ghostwhite;
width:400px;
}
<div class="container">
<div class="row">
<table border=0>
<tr>
<td class="col1">WORD</td>
<td id="midCol" rowspan="6">
<h2 >C</br>R</br>E</br>A</br>T<span id="iconArrow" class="glyphicon glyphicon-triangle-right"></span></br>I</br>N</br>G</h2>
</td>
<td class="col2">SENTENCE</td>
</tr>
<tr>
<td class="col1">WORD</td>
<td class="col2">SENTENCE</td>
</tr>
<tr>
<td class="col1">WORD</td>
<td class="col2">SENTENCE</td>
</tr>
<tr>
<td class="col1">WORD</td>
<td class="col2">SENTENCE</td>
</tr>
<tr>
<td class="col1">WORD</td>
<td class="col2">SENTENCE</td>
</tr>
<tr>
<td class="col1">WORD</td>
<td class="col2">SENTENCE</td>
</tr>
</table>
</div>
</div>
Instead of setting the left or right attribute on the absolute-positioned element, use auto to centre it, and then left/right margin to nudge it along.
E.g. these settings look about right:
#iconArrow {
right: auto;
margin-left: 6px;
/* other attributes */
}

Div Gets 0 Height Instead Of The % Of Its Parent

In the code below, div with red background gets 0 height when the image is there but with image node removed, it gets the correct height of 60px from the parent. Why is it and how can it be corrected?
Here is also the jsfiddle link: https://jsfiddle.net/zuymamq7/
html,body{
width:100%;
height:100%;
}
<table style="width:100%;height:100%;">
<tr style="height:60px;">
<td>
<div style="width:100%; height:100%; background-color:blue;">
<img src="http://www.bensound.com/bensound-img/betterdays.jpg" style="width:60px; height:60px;"></img>
<div style="display:inline-block;width: 10%; height:100%; background-color:red;">
</div>
</div>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
Biggest thing that I noticed as I began to edit this:
You added a close image tag (</img>). Those don't exist. The correct syntax is either <img src="something.jpg"> or more technically <img src="something.jpg" /> Threw off some things a lot (especially in the editor)
I'm thinking this is what you want, or at least, I hope.
html,
body {
width: 100%;
height: 100%;
}
<table style="width:100%;height:100%;">
<tr>
<td style="height:60px">
<div style="width:100%; height:100%; background-color:blue;">
<img src="http://www.bensound.com/bensound-img/betterdays.jpg" style="width:60px; height:60px;" />
<div style="display:inline-block;width: 10%; height:100%; background-color:red;">
</div>
</div>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
Other Way
If you can change up the HTML a bit, then this should work too.
html,
body {
height: 100%;
width: 100%;
}
table {
border-collapse: collapse;
}
<table style="width:100%;height:100%;">
<tr style="background-color:blue">
<td style="height:60px;width:60px;">
<img src="http://www.bensound.com/bensound-img/betterdays.jpg" style="width:60px; height:60px;" />
</td>
<td style="background-color:red; width:10%">
Text
</td>
<td> </td>
</tr>
<tr>
<td>
</td>
</tr>
</table>

Primefaces: Not able to center align p:chart

My xhtml code is
<p:outputPanel id="topperchartcont">
<p:outputPanel rendered="#{performanceStaffController.reportType == 'TP'}">
<table style="width: 100%">
<tr>
<td style="width: 10%">
</td>
<td style="width: 80%; text-align:center">
<h:panelGrid column="1">
<h:panelGroup style="width:80%; display:block; text-align:center">
<table style="border:1px solid #D8D8D8">
<tr>
<td style="text-align:center">
<p:chart type="bar" model="#{performanceStaffController.topperChartModel}"
rendered="#{performanceStaffController.topperChartModel != null}"
style="#{performanceStaffController.perfBean.chartWidth}"/>
</td>
</tr>
</table>
</h:panelGroup>
</h:panelGrid>
</td>
<td style="width: 10%">
</td>
</tr>
</table>
</p:outputPanel>
</p:outputPanel>
I also tried without the PanelGrid/PanelGroup
<p:outputPanel id="topperchartcont">
<p:outputPanel rendered="#{performanceStaffController.reportType == 'TP'}">
<table style="width: 100%">
<tr>
<td style="width: 10%">
</td>
<td style="width: 80%; text-align:center">
<table style="border:1px solid #D8D8D8">
<tr>
<td style="text-align:center">
<p:chart type="bar" model="#{performanceStaffController.topperChartModel}"
rendered="#{performanceStaffController.topperChartModel != null}"
style="#{performanceStaffController.perfBean.chartWidth}"/>
</td>
</tr>
</table>
</td>
<td style="width: 10%">
</td>
</tr>
</table>
</p:outputPanel>
</p:outputPanel>
I even tried other options like using div etc. but I am no way able to center align the p:chart inside that table-data, it is always left aligned. Please suggest how to center align it.
Note that there is no other problem with any of the components and the chart renders perfectly.
Try .center-block to make <p:chart> element's position center and .text-center to make inside text/elements center if any.
.center-block {
display:block;
margin-right:auto;
margin-left:auto;
}
.text-center {text-align:center}

custom table td witdh

The problem :
HTML
<div class="visible-sm visible-xs " id="aatablet" style="padding-left: 0px; padding-bottom:10px; padding-top:10px; text-align: center;">
<table border="1">
<tr>
<td colspan="4" class="item_title">
<div style="padding-top:5px;">
Available at:
</div>
</td>
</tr>
<tr>
<td >
<img src="img/amazon-lrg.gif" alt="amazon" />
</td>
<td>
<img src="img/ebay-lrg.gif" alt="ebay" />
</td>
<td >
<img src="img/tomatomill-lrg.gif" alt="tomatomill" />
</td>
<td ><img src="img/BBG-lrg.gif" alt="BBG" />
</td>
</tr>
<tr>
<td >
</td>
<td>
<img src="img/sears-lrg.gif" alt="sears" />
</td>
<td >
<img src="img/healthcraft-home-logo.gif" alt="Healthcraft" title="Healthcraft" />
</td>
<td >
<img src="img/paradisecozycabins.jpg" alt="paradisecozycabins" title="paradisecozycabins" />
</td>
</tr>
</table>
</div>
CSS
#aatablet > table {
margin:0 auto;
}
Framework:bootstrap 3.4.
I want to make td of tomato logo width 100px not 178px like Helt Craft and td of Paradise(last td) 50px not 150px like BIGGAME.
Can someone help me ?I'm not good at making custom tables.Is it possible to do it whit only CSS?
Ty all.
You can give inline:block for td and give separate widths. Target each td using :nth-of-type
td{
display: inline-block;
}
tr:first-child td:nth-of-type(3){
width: 100px;
}
tr:last-child td:nth-of-type(4){
width: 50px;
}

div with dynamic elements pushing other div down

So, I have a predicament. My tabs are pushing down the content below it. Here is some of the code:
<div id="navigation">
<div id="test" class="blue">
<p>Home</p>
<p class="subtext">View/update contact information</p>
</div>
<div id="lessons" class="blue">
<p>Projects</p>
<p class="subtext">Create/open projects, view existing reports</p>
</div>
<div id="test" class="blue">
<p>Help</p>
<p class="subtext">If something doesn't work, click here</p>
</div>
</div>
<div id="contain3">
<table id="maintable" align="center" width="940" cellspacing="0" cellpadding="0" class="lessontablemain">
<tr align="center" valign="top">
<td height="500" cellpadding="0" cellspacing="0">
<!--<div id="maincontent">-->
<table align="left" cellspacing="4" cellpadding="4" style=" margin-top:10px; background-color:transparent; border: 0;" width="100%" class="textfont_charms">
<tr>
<td cellspacing="0" cellpadding="0" align="center" valign="top">
<br>
<!--template up-->
<!--side bar table below -->
<? include_once("sidebar.php"); ?>
</td>
<td cellspacing="0" cellpadding="0" width="100%" valign="top" align="center">
<table id="maintable" style=" margin-top:10px; background-color:transparent; border: 0;" cellspacing="0" cellpadding="0" height="100%" valign="top" width="100%">
<tr>
<td valign="top" align="center" width="100%" cellspacing="0" cellpadding="0" height="100%">
<div align="center" id="content" style="vertical-align: top;"></div>
</td>
</tr>
</table>
<!--template down-->
</div>
</td>
</tr>
</table>
</tr>
<tr valign="bottom">
<td style="background-color: #E2E2E2;">
<?
include('template/footer_tmpl.php');
?>
</td>
</tr>
</table>
</div>
Here is my css:
#contain3{
width:940px;
margin-left:auto;
margin-right:auto;
text-align:left;
/*position: absolute;*/
top: 137;
z-index: -1;
}
#navigation{
width:940px;
margin-left: 8px;
text-align:left;
font-family:"Lucida Grande","Lucida Sans",sans-serif;
font-size:12px;
top: 109;
/*position: absolute;*/
z-index: 2;
}
To see what I'm talking about, my site is: http://www.charmscorp.com/inspect/projects.php - click on the tabs up above. Don't mind the slowness of the site, it's a server issue... so you have to wait a few seconds for the tabs to initialize.
Also, as you can see, I commented out position absolute. I thought that would be the answer, but instead, it just put the tab div on top of the content... Please help, this is giving me a headache!
Instead of making the divs with class "blue" higher - and thus revealing the drop down - why don't you show() the paragraphs with class "subtext" themselves instead?
Have them set to display: none by default, and use JavaScript to reveal them. You'll need to set them to position: absolute also, so they don't push any content down.
ok, I fixed this. I made the position: absolute, and then margin-top:27px, which pushed the content div down to where I wanted it to be. Another problem arose though, which is IE related. I'll start a new thread for that one though, as it's a new problem. Thanks!

Resources