I am simply trying to create a hover, so it hover over a entire section as seen below:
However, every time i hover over my products.
This happens instead
It adds extra white space to the section below and doesn't cover the section properly.
I have tried..
Changing the line height
Adding a new section/div
padding 0, margin 0
div#cat{
/*line-height: 30%;
height: 50px;*/
width: 61%;
margin-left: 39%;
height: 15px;
line-height: 50%
}
/*product area rollover/hover*/
div#cat:hover{
background-color: #e86065;
opacity: 0.5;
filter: Alpha(opacity=50);
background-position: 100% 100%;
height: 80%;
}
<div id='cat'>
<table>
<tr>
<td class='full'>
<a name='foodcat$iii' id='prods_nme'>$prod_name</a>
<td>
</td>
<p id='prods_desc'>$prod_desc</p>
</td>
<td class='price'>
<p id='prods_price'>£$prod_price</p>
</td>
<td class='add'>
<a href='Shopping_cart.php?add_item=$prod_id'>+</a>
</td>
</tr>
</table>
</div>
My code is actually a string, which loop information out of a database.
echo("<div id='cat$i' class='cat'>");
echo("<table>");
echo("<tr>");
echo("<td class='full'>");
echo("<a name='foodcat$iii' id='prods_nme'>$prod_name</a>");
echo("<td>");
echo("</td>");
echo("<p id='prods_desc'>$prod_desc</p>");
echo("</td>");
echo("<td class='price'>");
echo("<p id='prods_price'>£$prod_price</p>");
echo("</td>");
echo("<td class='add'>");
echo("<a href='Shopping_cart.php?add_item=$prod_id'>+</a>");
echo("</td>");
echo("</tr>");
echo("</table>");
echo("<br>");
echo("<br>");
echo("<hr id='hr'>");
echo("</div>");
echo("</div>");
echo("</div>");
echo("<br>");
echo("<br>");
$i++;
Your CSS is adding extra height when it changes to hover state. Make sure when you're adding hover styles that you only change the properties you want to - in this case, you don't want to change the height.
You want something like this:
div#cat{
width: 61%;
margin-left: 39%;
height: 15px;
line-height: 50%
}
/*product area rollover/hover*/
div#cat:hover{
background-color: #e86065;
opacity: 0.5;
filter: Alpha(opacity=50);
background-position: 100% 100%;
width: 61%;
margin-left: 39%;
height: 15px;
line-height: 50%
}
ArtOfCode has the correct solution for your problem.
However, it is not a good idea to use tables for formatting. You can see the table padding (which I have done all the right things to eliminate) when the cells are given borders. Tables bring with them a number of formatting problems.
I suggest that you use DIVs instead, and learn the three or four things needed to use float:left and/or flexbox.
table{border-collapse:collapse;}
td{border:1px solid #ccc;padding:0;}
div#cat {
/*line-height: 30%;
height: 50px;*/
width: 61%;
margin-left: 39%;
height: 15px;
line-height: 50%
}
/*product area rollover/hover*/
div#cat:hover {
background-color: #e86065;
opacity: 0.5;
filter: Alpha(opacity=50);
background-position: 100% 100%;
height: 80%;
}
<div id='cat'>
<table>
<tr>
<td class='full'>
<a name='foodcat$iii' id='prods_nme'>$prod_name</a>
<p id='prods_desc'>$prod_desc</p>
</td>
<td class='price'>
<p id='prods_price'>£$prod_price</p>
</td>
<td class='add'>
<a href='Shopping_cart.php?add_item=$prod_id'>+</a>
</td>
</tr>
</table>
</div>
Related
I have multiple tables across my application. (plain html, css etc, no framework except jQuery)
In some of the td's inside of those tables i have input fields. In some inputs i want to place a downwards pointing arrow, so that the user knows they can click on it to get a custom made dropdown list.
For a while now i've been using something in the line of the example shown below.
So, the user needs to see an input field inside of which on the right side there is a downwards facing arrow.
Also, the text that the user fills in the input field must not go underneath the arrow.
The issue is that the arrow has a fixed width of 20px and a height of 20px, but the input field needs to be as wide as the width of the td minus the width of the arrow (20 px). Setting the input's width to a percentage doesn't work because when the td varies in size, there will be a blank space in between the input and arrow.
CSS:
.col1{
width: 300px;
background-color: yellow;
}
.col2{
width:300px;
background-color: lightgrey
}
.col1 input{
width: 100%;
}
.ArrowBox {
position: relative;
right: 0px;
width: 20px;
height: 20px;
display: inline-block;
background-color: red;
}
.ArrowIcon {
position: relative;
top: -3px;
left: 4px;
width: 10px;
height: 10px;
border: solid white;
border-width: 0 1px 1px 0;
display: inline-block;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
HTML:
<table>
<tr>
<td class="col1">
<input type="text" value="" class="input1">
<i class="ArrowDownBox">
<i class="InputArrowDownIcon"></i>
</i>
</td>
<td class="col2">Line 1, Column 2</td>
</tr>
<tr>
<td class="col1">
<input type="text" value="" class="input2">
<i class="ArrowDownBox">
<i class="InputArrowDownIcon"></i>
</i>
</td>
<td class="col2">Line 2, Column 2</td>
</tr>
</table>
I've put a simple example in a fiddle here:
https://jsfiddle.net/j6ocL702/
The colors used are for example purposes.
Can anyone help me with this? i'm at a loss and google isn't my friend with this atm...
Try giving the input padding-right: 20px; that will stop users typing under the arrow if you position the input relative and the down arrow absolute with right: 0
You'll probably have to fiddle around to make sure default margin or padding isn't being picked up.
I have a table under a searchbar. When I write something inside it, it filters that word with my skills list and the table appears bottom the bar.
Everything works well but not the size of this div because it have an height of 300px so if I have 10 skills is ok, but if the skill are, for example, 2, every td will have a height of 150px.
So I would like to fix this with a max height of 300px and when the rows decrease I want the table to get smaller.
HTML
<div class="container">
<ng-container
*ngIf="searchString.searchString && (searchSkills.getAllSkill() | filterAll : searchString.searchString) as filteredSkills">
<ng-container *ngIf="filteredSkills.length > 0">
<div class="suggerite">
<cdk-virtual-scroll-viewport [itemSize]="10" class="sugtab style-bar modal-bar">
<table class="sugtab">
<tbody>
<tr *cdkVirtualFor="let skill of filteredSkills" class="sugtag">
<td (click)="addToSearch(skill)" class="skill">
{{skill.name}}
</td>
</tr>
</tbody>
</table>
</cdk-virtual-scroll-viewport>
</div>
</ng-container>
</ng-container>
</div>
CSS
.suggerite{
position: relative;
border: 1px solid #064a94;
border-radius: 5px;
background-color: rgba(255,255,255,0.9);
color: #064a94;
z-index: 100;
cursor: pointer;
padding-left: 0 !important;
padding-right: 0 !important;
}
.sugtab{
height: 200px;
width: 100%;
font-family: sans-serif;
}
tr.sugtab {
height: 50px;
}
td.skill{
padding: 3px;
}
I tried to use max height and different things but probably in wrong places.
I'm working on a website and I've to create a table with a mouse over effect the effect is only when you go with the mouse on the picture and only on the PDF icon.
What I need now is to apply this effect when you go with the mouse on the single table rows. How can I do it?
HTML:
<td class="thumbnail-item" data-th="PDF"><img src="http://salmenpark-test.nowcommu.myhostpoint.ch/wp-content/uploads/2015/07/pdf.png" alt="PDF" height="24" width="24">
<div class="tooltip">
<img src="qh_1.png" alt="" width="570" height="403" />
<span class="overlay"></span>
<span class="overlay"></span>
</div></td>
CSS :
.thumbnail-item {
/* position relative so that we can use position absolute for the tooltip */
display: inherit;
height: 10px;
max-width: 5px;
}
.thumbnail-item a {
display: block;
}
.tooltip {
/* by default, hide it */
display: none;
/* allow us to move the tooltip */
position: absolute;
/* align the image properly */
padding: 8px 0 0 8px;
z-index: 500;
top: 7px;
left: -8px !important;
max-width: 570px !important;
max-height: 403px !important;
Antionio:
CSS:
.thumbnail-item {
/* delete the line that was here for inheriting the display * /
height: 10px;
max-width: 5px;
}
HTML:
<tr class="thumbnail-item white">...</tr>
<tr class="thumbnail-item grey">...</tr>
etc, etc.
You were adding the "thumbnail-item" css reference to the <td>tag which represents a cell of data. You want the "thumbnail-item" css reference to be on the entire row, so it should be on each <tr> tag instead.
In your Jquery code, use the class of your td.hover function and try with the below code.
$(".thumbnail-item").hover(function() {
//Write your js code what you have written for hover pdf image
});
It would be better for us to understand if you post your jquery code as well.
Html code:
<div class="CorpPerformance">
<div class="row">
<div class="DashboardTitle">
3 Month
</div>
<div class="DashboardScore" style="font-weight:bold">
<a class="redirectLink" data-criteria-corporatesummarycategory="none" data-criteria-corporatesummaryexpand="0" data-criteria-customerpay="" data-criteria-expressservice="" data-criteria-maintenanceplan="" data-criteria-modelname="" data-criteria-rspenddate="" data-criteria-rspstartdate="" data-criteria-warrantypay="" data-criteria-yearmodel="" data-criteria-department="Sales" data-criteria-reportperiod="[Collection Date].[Calendar].[Calendar Month].&[October 2014]" data-criteria-summaryperiod="3MONTH" href="/Corporate/OFSSurveySummary">950</a>
</div>
<div class="DashboardIcon">
<a class="bootstrap-modal" data-criteria-chartcustomerpay="" data-criteria-chartexpressservice="" data-criteria-chartmaintenanceplan="" data-criteria-chartmodelname="" data-criteria-chartmodelyear="" data-criteria-chartwarrantypay="" data-criteria-chartdepartment="SALES" data-criteria-chartmeasurename="Response Default Computation" data-criteria-chartmeasuretype="score" data-criteria-chartorganization="" data-criteria-chartpagetitle="NSSI Trend" data-criteria-chartreportperiod="[Collection Date].[Calendar].[Calendar Month].&[October 2014]" data-criteria-chartsummaryperiod="3MONTH" data-criteria-charttitle="NSSI" data-criteria-chartwheretuple="[Questionnaire].[Questionnaire].[Question].&[OFSP]&[OFSP13011]" href="/Trend" modal-no-resize="True" upper="NSSI Trend"><span>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAAAZCAYAAACM9limAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHxSURBVFhH7Zg9SEJRFMcdW4QmcRI3xclNcYiGBocGB4dqMQTXdHdoFRqsoCAtJEiMKCpCHkHkECFJUNQgNqgEIQ19DIFBw8n/8SkUPft66n31fnBArnLh/O69556roQHp8WEYSOctuhgFhBdTLN5RLndN2WxZHukNQoopFGrk9W6S1Zogu32FhofXyeFI0cBAnHy+HUqlLunh4Vn+dWfq9RcWG4+f0sjIBnk8aZ5vcHC+kfgMz/URQolBspHIIdlsyxSLnVCl8ih/0wRJbm9f0eSkREbjHJlMC5wkYmIiS4GAxEJbY2bzIsvEZ8w7O3vKkhCfiRVGDFYOuwMr+1Vqtad2oonEOU1NHZAkldtj78V+h76LyedvWIjfv8uJikLfxGA1x8b2yO1O8+qKRs/FYFeMjm5xHclkivKoePRMTKuw4qaZnj7mQioyPRETDjeFoLCKLqRF18XgGh0f3/ty3yEKXRODnYGeQqmBEp2uiMHuQIeKnkKrqC6mVLqnoaGMpqUAVcXg+rVYlrht1zqqiMHRwfsFDZvWiqwSvxaTTF5wS6/VIqvEj8Wcnd3yq9XlWqNq9eePNVHpKAZvGCSPY4JuFREK7fMOcTpXhXzjqEVHMQDJ45hASjR6RMGgxP+q/XU+FfNf0cUo0Bajx/sw0CuzQYKdi8e4ggAAAABJRU5ErkJggg==">
</span></a> </div>
<div class="CvalNational">
<span style="color:#fff;font-weight:bold;">
National
</span>
</div>
<br>
</div>
</div>
JSfiddle link :
http://jsfiddle.net/8nbyc9m7/
Output without zoom :
if i zoom to 110% or 150% or 60% zooming it gives different output. that means last section is not aligned properly.
with zoom:
how to maintain the same output for all levels of zooming in all browsers.
Setting the container to have a width equals to the parent container does the trick for me
http://jsfiddle.net/kursion/8nbyc9m7/2/
Btw... you should probably concider doing a simple table ?
.CorpPerformance {
padding-left: 5px; <----------- changed
display: table;
border: 2px solid gray;
border-radius: 5px;
vertical-align: middle;
line-height: 30px;
width: 340px; <----------- changed
}
.CorpPerformance .DashboardTitle {
width: 80px; <----------- changed
}
.CorpPerformance .DashboardScore {
width: 40px; <----------- changed
}
.CorpPerformance .DashboardIcon {
width: 100px; <----------- changed
}
.CorpPerformance .CvalNational {
width: 119px; <----------- changed
text-align: center;
border-left: 1px dotted black;
background-color: gray;
}
80px + 40px + 100px + 119px + 1px(border) = 340px
And I removed the padding
.CorpPerformance .row > div {}
Edit: with a table... it's much more easier and zoom works ! Check the link in my comment
http://jsfiddle.net/victor_007/8nbyc9m7/3/
* {
box-sizing:border-box;
}
use box-sizing:border-box; which gives border and padding from inside and set the width exactly which you want
Here is your solution.
What I did is to correct your table and remove the width of the last cell so that it can be flexible. I have used table and tr and td instead of div as it will make your css lighter.
If you can't or don't want to change your div for table, tr and td, you can always add the following css on your div: display: table; to replace table, display: table-row; to replace tr, and display: table-cell; to replace td. The result will be the same.
.CorpPerformance {
border: 2px solid gray;
border-radius: 5px;
vertical-align: middle; /* it's defined for the whole table so you don't need to write it again */
line-height: 30px;
max-width: 343px;
border-spacing: 0; /* important for Chrome browser that add spacing */
}
img {
max-width: 100%;
vertical-align: middle;
border: 0;
}
.CorpPerformance > td {
padding: 0 5px 3px; /* I've just simplified the writing */
}
.CorpPerformance .DashboardTitle {
width: 110px;
}
.CorpPerformance .DashboardScore {
width: 25px;
}
.CorpPerformance .DashboardIcon {
width: 75px;
}
.CorpPerformance .CvalNational { /* no width anymore */
text-align: center;
border-left: 2px dotted black;
background-color: gray;
color: #fff; /* I've remove your span to put the css here, if you can do this it's best to keep html free of css */
font-weight: bold;
}
<table class="CorpPerformance">
<tr>
<td class="DashboardTitle">3 Month</td>
<td class="DashboardScore" style="font-weight:bold"> <a class="redirectLink" data-criteria-corporatesummarycategory="none" data-criteria-corporatesummaryexpand="0" data-criteria-customerpay="" data-criteria-expressservice="" data-criteria-maintenanceplan="" data-criteria-modelname="" data-criteria-rspenddate=""
data-criteria-rspstartdate="" data-criteria-warrantypay="" data-criteria-yearmodel="" data-criteria-department="Sales" data-criteria-reportperiod="[Collection Date].[Calendar].[Calendar Month].&[October 2014]" data-criteria-summaryperiod="3MONTH"
href="/Corporate/OFSSurveySummary">950</a>
</td>
<td class="DashboardIcon">
<a class="bootstrap-modal" data-criteria-chartcustomerpay="" data-criteria-chartexpressservice="" data-criteria-chartmaintenanceplan="" data-criteria-chartmodelname="" data-criteria-chartmodelyear="" data-criteria-chartwarrantypay="" data-criteria-chartdepartment="SALES"
data-criteria-chartmeasurename="Response Default Computation" data-criteria-chartmeasuretype="score" data-criteria-chartorganization="" data-criteria-chartpagetitle="NSSI Trend" data-criteria-chartreportperiod="[Collection Date].[Calendar].[Calendar Month].&[October 2014]"
data-criteria-chartsummaryperiod="3MONTH" data-criteria-charttitle="NSSI" data-criteria-chartwheretuple="[Questionnaire].[Questionnaire].[Question].&[OFSP]&[OFSP13011]" href="/Trend" modal-no-resize="True" upper="NSSI Trend"><span>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAAAZCAYAAACM9limAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHxSURBVFhH7Zg9SEJRFMcdW4QmcRI3xclNcYiGBocGB4dqMQTXdHdoFRqsoCAtJEiMKCpCHkHkECFJUNQgNqgEIQ19DIFBw8n/8SkUPft66n31fnBArnLh/O69556roQHp8WEYSOctuhgFhBdTLN5RLndN2WxZHukNQoopFGrk9W6S1Zogu32FhofXyeFI0cBAnHy+HUqlLunh4Vn+dWfq9RcWG4+f0sjIBnk8aZ5vcHC+kfgMz/URQolBspHIIdlsyxSLnVCl8ih/0wRJbm9f0eSkREbjHJlMC5wkYmIiS4GAxEJbY2bzIsvEZ8w7O3vKkhCfiRVGDFYOuwMr+1Vqtad2oonEOU1NHZAkldtj78V+h76LyedvWIjfv8uJikLfxGA1x8b2yO1O8+qKRs/FYFeMjm5xHclkivKoePRMTKuw4qaZnj7mQioyPRETDjeFoLCKLqRF18XgGh0f3/ty3yEKXRODnYGeQqmBEp2uiMHuQIeKnkKrqC6mVLqnoaGMpqUAVcXg+rVYlrht1zqqiMHRwfsFDZvWiqwSvxaTTF5wS6/VIqvEj8Wcnd3yq9XlWqNq9eePNVHpKAZvGCSPY4JuFREK7fMOcTpXhXzjqEVHMQDJ45hASjR6RMGgxP+q/XU+FfNf0cUo0Bajx/sw0CuzQYKdi8e4ggAAAABJRU5ErkJggg==" /></span></a>
</td>
<td class="CvalNational">Test National</td>
</tr>
</table>
I have created a website that looks correct when the browser is big enough. But as you resize the browser and make it smaller, the filter section (ul with li items), changes from being horizontal to vertical.
If you go to the website www.andrewsimonmcallister.tv. Click on the music menu item.
The section that has the subtitle, followed by the filter section looks ok when the browser is wide enough but as you shrink the browser the entire thing changes to a vertical list with dots. Is there anyway to make the sort options stack horizontally, but within their container, then make the filter options stack, but keep the filter and sort sections horizontal.
Also, the same with the description section on the music list. I would like the text to wrap underneath, but stay within the description part, not go under the title.
All help would be great.
Ok now for the code
HTML
The top filter section
Music
Filter:
Orchestral
Electronic
Other
Display:
Soundtrack
Advertisement
The Description section
<ul>
<li class="tracknumber">
<div id="jp_container_1" class="jp-audio" style="display:inline-block;">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<ul class="jp-controls">
<li> </li>
<li> </li>
</ul>
<div name="prog1" class="jp-progress">
<div name="seek1" class="jp-seek-bar">
<div name="play1" class="jp-play-bar"></div>
</div>
</div>
</div>
</div>
</div>
<div id="number1" class="number">1</div>
</li>
<li class="tracktitle">Beginnings</li>
<li class="tracktime">2:04</li>
<li class="trackprogress"><div id="trackprogress1" class="trackprogressbar"></div></li>
<li class="trackcat">Orchestral</li>
<li class="trackdescription">Lush sweeping strings in this opening credits cue.</li>
</ul>
** CSS **
.contentinformation {
padding-left: 10px;
color: #303234;
font-size: 16px;
letter-spacing: 0;
}
.contentfilterlist {
display: inline-block;
list-style-type: none;
left: 0;
right: 0;
}
.contentfilteritem {
display:inline-block;
list-style-type: none;
}
.contentfiltertitle {
padding-left: 10px;
padding-right: 10px;
vertical-align: middle;
font-size: 18px;
letter-spacing: 0;
}
.contentfilteroption {
padding-left: 8px;
vertical-align: bottom;
}
.contentfiltertext {
padding-right: 6px;
vertical-align: middle;
letter-spacing: 0;
font-size: 13px;
font-variant: small-caps;
}
.contentfilterdivide {
padding-right: 80px;
}
.contentmain {
position: absolute;
left: 0;
right: 0;
top: 40px;
padding-left: 100px;
padding-right: 100px;
z-index: 11;
}
/****************************************
* Music
****************************************/
.tracktitle{
display:inline-block;
width: 250px;
}
.tracktime{
display:inline-block;
width: 55px;
}
.trackprogress{
display:inline-block;
width: 110px;
}
.trackprogressbar {
background: url("../images/music/progress-bg.gif") 0 0 repeat-x;
width:80px;
height:8px;
cursor: pointer;
opacity: 0.5;
-moz-opacity: 0.5;
filter:alpha(opacity=50);
z-index: 12;
}
.trackcat {
display:inline-block;
width: 135px;
}
.trackdescription{
display:inline;
}
All help is greatly appreciated!!
Thansk!
As mentioned in the comments, you should use the table element here:
<table>
<thead>
<tr>
<th>Tracknumber</th>
<th>Title</th>
<th>Time</th>
<th>Progress</th>
<th>Category</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Beginnings</td>
<td>2:04</td>
<td><div id="trackprogress1" class="trackprogressbar"></div></td>
<td>Orchestral</td>
<td>Lush sweeping strings in this opening credits cue.</td>
</tr>
<tr>
<td>…</td>
<td>…</td>
<td>…</td>
<td>…</td>
<td>…</td>
<td>…</td>
</tr>
</tbody>
</table>