Change table information on mouseover? - html

I know this is similar to my other question but I made it too hard to understand so I have made this one
I have two tabs:
"Search" and "Tags"
"Search" is the default tab so I have a rounded edge box in the table behind the text BUT not as a background
I want this rounded edge box to be behind the 'Tags' tab when i put the mouse over 'Tags'
How do I do this?
HTML:
<table height="20" width="30" cellpadding="0" cellspacing="0">
<tr>
<td>
<div class="roundedcornr_box_407494">
<div class="roundedcornr_top_407494"><div></div></div>
<div class="roundedcornr_content_407494">
<font color="#ffffff" size="2" face="helvetica">
Search
</font>
</div>
<div class="roundedcornr_bottom_407494"><div></div></div>
</div>
</td>
</tr>
</table>
</td>
<td>
<div style="margin-left:10px;" />
<center>
<table height="20" width="30" cellpadding="0" cellspacing="0" >
<tr>
<td>
<center>
<div class="roundedcornr_box_235759">
<div class="roundedcornr_top_235759"><div></div></div>
<div class="roundedcornr_content_235759">
<font color="#585858" size="2" face="helvetica">
Tags
</font> </div>
<div class="roundedcornr_bottom_235759"><div></div></div>
</div>
</center>
</td>
</tr>
</table>
CSS:
.roundedcornr_box_407494 {
background: #bdbdbd;
}
.roundedcornr_top_407494 div {
background: url(roundedcornr_407494_tl.png) no-repeat top left;
}
.roundedcornr_top_407494 {
background: url(roundedcornr_407494_tr.png) no-repeat top right;
}
.roundedcornr_bottom_407494 div {
background: url(roundedcornr_407494_bl.png) no-repeat bottom left;
}
.roundedcornr_bottom_407494 {
background: url(roundedcornr_407494_br.png) no-repeat bottom right;
}
.roundedcornr_top_407494 div, .roundedcornr_top_407494,
.roundedcornr_bottom_407494 div, .roundedcornr_bottom_407494 {
width: 100%;
height: 5px;
font-size: 1px;
}
.roundedcornr_content_407494 { margin: 0 5px; }
Thanks!
James

You can give your tab div an ID, and then when mouseover change its class to the same as Seach, and then back on mouse out.
You should try and put all your styling in the CSS, as you have center and font tags in the mix. Also, alot of new browsers offer rounded corner support for css3, maybe not a fix for you but just wanted to point that out.

Related

How to align text in the box in HTML so that it does not affect the spacing on each side

I am a newbie in HTML and currently working on my University project work and I really need some help. I am using a background box for the "blog-like" website which needs to align title and short text on the left and contents with hyperlinks on the right.
So far I have used a cell to align them but to say the least, it looks very ugly and moreover affects spacing. No matter what I tried I can't change the contents on both sides without a response from another. Is it possible to arrange content somehow another way instead of using a single cell for an entire box and dividing percentage for each side? I have uploaded a picture of the website below
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
Your Personal Guide To Best Hardcore Events
</title>
<style type="text/css">
body {
background: url(http://webprojects.eecs.qmul.ac.uk/at315/background.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
background-attachment: fixed
}
.background {
display: flex;
justify-content: center;
}
div.transbox {
margin: 0px;
background-color: #ffffff;
border: 1.5px solid black;
opacity: 0.6;
filter: alpha(opacity=60);
width: 100%;
max-width: 1300px;
}
</style>
</head>
<body>
<p align="center">
<img src="http://webprojects.eecs.qmul.ac.uk/at315/header.png" style="width:70%;" border="0" alt="" />
</p>
<div class="background">
<div class="transbox">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<th width="75%" align="left">
<h2>
Articles:
</h2>
</th>
<th width="20%" align="center">
<ul style="list-style: none;">
<li>
Homepage
<br />
<br />
</li>
<li>
<small><a href="http://www.qmul.ac.uk" style=
"text-decoration:none">Architects</a></small>
</li>
<li>
<small><a href="https://www.facebook.com" style=
"text-decoration:none">Northlane</a></small>
</li>
<li>
<small><a href="http://www.bbc.co.uk" style=
"text-decoration:none">Attila</a></small>
</li>
</ul>
</th>
</tr>
<tr>
<td align="left">
<h4>
<strong>Architects Rocking Brixton</strong>
</h4>Read our article about Architects headlining their biggest sold-out UK show!
<hr />
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td align="left">
<h4>
<strong>Architects Rocking Brixton</strong>
</h4>Read our article about Architects headlining their biggest sold-out UK show!
<hr />
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td align="left">
<h4>
<strong>Architects Rocking Brixton</strong>
</h4>Read our article about Architects headlining their biggest sold-out UK show!
<br />
<br />
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
Main page of the website
In this situations it is best to use flex and max width. It is very good to responsive design so.
.background {
display: flex;
justify-content: center;
}
div.transbox {
margin: 30px;
background-color: #ffffff;
border: 1px solid black;
opacity: 0.6;
filter: alpha(opacity=60);
width: 100%;
max-width: 1000px;
}
Change your browser size, It work good for all sizes. And the best part is if the screen has width < 1000px the table fills all of the screen.
just change this tag:
<table style="padding:0 5% " width = "90%" border="0" cellpadding="0" cellspacing="0">

Bring element to front using CSS

I can't figure out how to bring images to front using CSS. I've already tried setting z-index to 1000 and position to relative, but it still fails.
Here's example-
#header {
background: url(http://placehold.it/420x160) center top no-repeat;
}
#header-inner {
background: url(http://placekitten.com/150/200) right top no-repeat;
}
.logo-class {
height: 128px;
}
.content {
margin-left: auto;
margin-right: auto;
table-layout: fixed;
border-collapse: collapse;
}
.td-main {
text-align: center;
padding: 80px 10px 80px 10px;
border: 1px solid #A02422;
background: #ABABAB;
}
<body>
<div id="header">
<div id="header-inner">
<table class="content">
<col width="400px" />
<tr>
<td>
<table class="content">
<col width="400px" />
<tr>
<td>
<div class="logo-class"></div>
</td>
</tr>
<tr>
<td id="menu"></td>
</tr>
</table>
<table class="content">
<col width="120px" />
<col width="160px" />
<col width="120px" />
<tr>
<td class="td-main">text</td>
<td class="td-main">text</td>
<td class="td-main">text</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!-- header-inner -->
</div>
<!-- header -->
</body>
Add z-index:-1 and position:relative to .content
#header {
background: url(http://placehold.it/420x160) center top no-repeat;
}
#header-inner {
background: url(http://placekitten.com/150/200) right top no-repeat;
}
.logo-class {
height: 128px;
}
.content {
margin-left: auto;
margin-right: auto;
table-layout: fixed;
border-collapse: collapse;
z-index: -1;
position:relative;
}
.td-main {
text-align: center;
padding: 80px 10px 80px 10px;
border: 1px solid #A02422;
background: #ABABAB;
}
<body>
<div id="header">
<div id="header-inner">
<table class="content">
<col width="400px" />
<tr>
<td>
<table class="content">
<col width="400px" />
<tr>
<td>
<div class="logo-class"></div>
</td>
</tr>
<tr>
<td id="menu"></td>
</tr>
</table>
<table class="content">
<col width="120px" />
<col width="160px" />
<col width="120px" />
<tr>
<td class="td-main">text</td>
<td class="td-main">text</td>
<td class="td-main">text</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!-- header-inner -->
</div>
<!-- header -->
</body>
Note: z-index only works on positioned elements (position:absolute, position:relative, or position:fixed). Use one of those.
In my case i had to move the html code of the element i wanted at the front at the end of the html file, because if one element has z-index and the other doesn't have z index it doesn't work.
Another Note: z-index must be considered when looking at children objects relative to other objects.
For example
<div class="container">
<div class="branch_1">
<div class="branch_1__child"></div>
</div>
<div class="branch_2">
<div class="branch_2__child"></div>
</div>
</div>
If you gave branch_1__child a z-index of 99 and you gave branch_2__child a z-index of 1, but you also gave your branch_2 a z-index of 10 and your branch_1 a z-index of 1, your branch_1__child still will not show up in front of your branch_2__child
Anyways, what I'm trying to say is; if a parent of an element you'd like to be placed in front has a lower z-index than its relative, that element will not be placed higher.
The z-index is relative to its containers. A z-index placed on a container farther up in the hierarchy basically starts a new "layer"
Incep[inception]tion
Here's a fiddle to play around:
https://jsfiddle.net/orkLx6o8/

How to make JqueryUi Slider vertical-align middle?

here's my code:
<div class="search-option">
<div id="slider-days" class="search-opt-left"></div>
<input type="text" id="amount-days" class="search-opt-right input-small"/>
</div>
I want to make the slider and input field algin to the middle of the line.
How can i do that ? Thanks !
My CSS:
.search-opt-left {
float: left;
width: 250px;
vertical-align: middle;
}
.search-opt-right {
float: left;
margin-left: 20px;
}
This can be buggy.
What I usually do is make a table. And since table rows start with vertically-centered alignments, it's quite simple.
<div class="search-option">
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<div id="slider-days" class="search-opt-left"></div>
</td>
<td>
<input type="text" id="amount-days" class="search-opt-right input-small"/>
</td>
</tr>
</table>
</div>
You may then alter your CSS to get rid of the un-needed stuff.

position text on top just beside the image in html

I have an image and text beside it with this code. A sample can be seen here:
The problem is that the text is starting from the center of the image (on the right side) whereas i want the text to start from the top right-hand side of the image.
Here is my code:
<table width="550">
<tr>
<td>
<div id="i1">
<img src="<? echo $row_array[3];?>" height="225" width="225">
</div>
</td>
<td>
<div id="i2">
<span style="position: relative; top: 0px; left: 0px;">
<? echo $row_array[4];?>
</span>
</div>
</td>
</tr>
<tr></tr>
<?} ?>
</table>
I have even tried to remove span but it still shows the same way.
i1 in css: margin-left:0px;
i2 in css:
#i2
{
display: inline;
margin: 0px 0px 0px 0px;
padding:0px 0px 0px 0px;
}
I think, unless I'm missing something, that the following should achieve your aims:
td {
vertical-align: top;
}
This will obviously apply to all tds, so you may wish to specify a particular class or id.
Add valign="top" attribute to the <td> that contains the text.

Image Border not aligning properly

I have an image, which I am trying to create a border around it, to make it look nicer. I have sliced an image, to have an image for top right, top, top left, right, left, bottom right, bottom left and bottom..
The border is all fine, except for the corners, can any body help me out here? I think Im missing some CSS. The image appears to be sliced fine - but Im open to suggestions.
Thanks and kind regards
This is the HTML
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td >
<img alt="Corner" src="graphics/bgTopLeft.PNG" width="15px" height="13px" /></td>
<td class="AdminBoxTitleMainTop" >
</td>
<td>
<img alt="Corner" src="graphics/bgTopRight.PNG" /> </td>
</tr>
<tr>
<td class="AdminBoxTitleMainLeft">
</td>
<td> <img id="afMgrPhoto" alt="Affiliate Manager" src='#' runat="server" />
</td>
<td class="AdminBoxTitleMainRight">
</td>
</tr>
<tr>
<td>
<img alt="Corner" src="graphics/bgBottomLeft.PNG" /> </td>
<td class="AdminBoxTitleMainBottom">
</td>
<td >
<img alt="Corner" src="graphics/bgBottomRight.PNG" /> </td>
</tr>
</table>
This is the CSS
.AdminBoxTitleMainTop {
background-image: url(../graphics/bgTop.PNG);
background-repeat: repeat-x;
height: 17px;
}
.AdminBoxTitleMainBottom {
background-image: url(../graphics/bgBottom.PNG);
background-repeat: repeat-x;
height: 17px;
}
.AdminBoxTitleMainRight {
background-image: url(../graphics/bgRight.PNG);
background-repeat: repeat-y;
height: 17px;
}
.AdminBoxTitleMainLeft {
background-image: url(../graphics/bgLeft.PNG);
background-repeat: repeat-y;
height: 17px;
}
You can try setting the width property for the rightmost and the leftmost cells (td elements). I guess you are trying to give a border using supplementary images which is not the best practice in HTML unless you're doing some rounded corner stuff. But if you don't want rounded corners. You can just use an IMG element and give a border (event with some padding) to make it look nice (and fewer HTML codes, which is nicer.)
<img style="padding: 5px; border: solid 1px #dedede" src="img.png" alt="" />
You can event shift the border color for the mouseover event of the image (works only if you place the img element inside element) without any javascript.
<a href='#'><img src="img.png" alt="" /></a>
Style:
a img
{
border: solid 1px #dedede;
padding: 5px;
}
a:hover img
{
border-color: #069;
}