I am new to HTML5. I used to code HTML years ago, but I am not familiar with the new ways of doing things. I'm basically starting from scratch. I have started a design and the beginnings of code for a website I want to put up. Before I go farther, I wanted to get what I have done looking properly. There is padding around each image that I'm am unsure of how to remove. I need all images to put up against each other. I've tried putting padding: 0 and margin: 0 on all elements in the code, but nothing is working. What am I doing wrong?
Images with padding I want removed
Here's a snippet of the code I'm using:
<style>
html, body { padding: 0; margin: 0 }
</style>
</head>
<body>
<header>
<img src="images/logo.gif" />
</header>
<nav>
<table>
<tr>
<td>
<img src="images/purpleBarLeftOfNav.gif" width="173" height="77" alt="" title="" />
<img src="images/navHomeTopSel.gif" alt="Home" title="" />
<img src="images/navAboutTop.gif" alt="About" title="" />
<img src="images/navServicesTop.gif" alt="Services" title="" />
<img src="images/navPortfolioTop.gif" alt="Portfolio" title="" />
<img src="images/navContactTop.gif" alt="Contact" title="" />
<img src="images/purpleBarPgTitleHome.gif" alt="Home" title="" />
</td>
</tr>
<tr>
<td>
<img src="images/spacerWhite.gif" width="114" height="146" alt="spacer" title="" />
<img src="images/phoneEmail.gif" width="59" height="146" alt="Phone and Email" title="" />
<img src="images/navHomeBtmSel.gif" width="32" height="146" alt="Home" title="" />
<img src="images/navAboutBtm.gif" width="32" height="146" alt="About" title="" />
<img src="images/navServicesBtm.gif" width="32" height="146" alt="Services" title="" />
</td>
</tr>
</table>
</body>
Today, 2016, we use flexbox for layout, not table (unless you need to make it work on older browsers)
html,
body {
margin: 0
}
div {
display: flex;
}
<div>
<img src="http://placehold.it/50" width="114" height="146" alt="spacer" title="" />
<img src="http://placehold.it/50" width="59" height="146" alt="Phone and Email" title="" />
<img src="http://placehold.it/50" width="32" height="146" alt="Home" title="" />
<img src="http://placehold.it/50" width="32" height="146" alt="About" title="" />
<img src="http://placehold.it/50" width="32" height="146" alt="Services" title="" />
</div>
<div>
<img src="http://placehold.it/50" width="114" height="146" alt="spacer" title="" />
<img src="http://placehold.it/50" width="59" height="146" alt="Phone and Email" title="" />
<img src="http://placehold.it/50" width="32" height="146" alt="Home" title="" />
<img src="http://placehold.it/50" width="32" height="146" alt="About" title="" />
<img src="http://placehold.it/50" width="32" height="146" alt="Services" title="" />
</div>
And if you really can't use flexbox, just float them
html,
body {
margin: 0
}
div:after {
content: '';
clear: both;
display: block;
}
div img {
float: left;
}
<div>
<img src="http://placehold.it/50" width="114" height="146" alt="spacer" title="" />
<img src="http://placehold.it/50" width="59" height="146" alt="Phone and Email" title="" />
<img src="http://placehold.it/50" width="32" height="146" alt="Home" title="" />
<img src="http://placehold.it/50" width="32" height="146" alt="About" title="" />
<img src="http://placehold.it/50" width="32" height="146" alt="Services" title="" />
</div>
<div>
<img src="http://placehold.it/50" width="114" height="146" alt="spacer" title="" />
<img src="http://placehold.it/50" width="59" height="146" alt="Phone and Email" title="" />
<img src="http://placehold.it/50" width="32" height="146" alt="Home" title="" />
<img src="http://placehold.it/50" width="32" height="146" alt="About" title="" />
<img src="http://placehold.it/50" width="32" height="146" alt="Services" title="" />
</div>
A <table> and <img> based layout/design is probably not the best direction to be heading these days.
To answer your question you're likely seeing white space from a couple of places.
Spaces between table cells - use border-collapse: collapse; to remove. You might have to remove padding from the table cells as well.
Space around images - images are inline elements and as such have space for descenders, the parts of a letter form that fall below the baseline, and space around the image as well (at least if there's space between the <img> in your markup. Since you have images in a row you can float them or use flexbox to get rid of the space around them. In other instances you'd want to make the images display: block; to remove the inline white space.
Example 1 - What you likely have
td {
background-color: red;
}
<table>
<tr>
<td>
<img src="http://placehold.it/100x100/ffcc00">
</td>
</tr>
<tr>
<td>
<img src="http://placehold.it/100x100/ffcc00">
</td>
</tr>
</table>
Example 2 - More modern approach, NO TABLES with FLEXBOX
.flex {
display: flex;
}
<header>
<div class="flex">
<img src="http://placehold.it/100x100/ffcc00">
<img src="http://placehold.it/100x100/aacc00">
<img src="http://placehold.it/100x100/ffcc00">
</div>
<nav class="flex">
<img src="http://placehold.it/50x50/ffcc00">
<img src="http://placehold.it/50x50/aacc00">
<img src="http://placehold.it/50x50/ffcc00">
<img src="http://placehold.it/50x50/aacc00">
<img src="http://placehold.it/50x50/ffcc00">
<img src="http://placehold.it/50x50/aacc00">
</nav>
</header>
Example 3 - More modern approach, NO TABLES with FLOAT
/* Clearfix to clear floats - http://nicolasgallagher.com/micro-clearfix-hack/ */
.cf:before,
.cf:after {
content: " ";
/* 1 */
display: table;
/* 2 */
}
.cf:after {
clear: both;
}
img {
float: left;
}
<header>
<div class="cf">
<img src="http://placehold.it/100x100/ffcc00">
<img src="http://placehold.it/100x100/aacc00">
<img src="http://placehold.it/100x100/ffcc00">
</div>
<nav class="cf">
<img src="http://placehold.it/50x50/ffcc00">
<img src="http://placehold.it/50x50/aacc00">
<img src="http://placehold.it/50x50/ffcc00">
<img src="http://placehold.it/50x50/aacc00">
<img src="http://placehold.it/50x50/ffcc00">
<img src="http://placehold.it/50x50/aacc00">
</nav>
</header>
Example 4 - Old school with FLOAT
td {
padding: 0;
background-color: red;
}
table {
border-collapse: collapse;
}
img {
float: left;
}
<table>
<tr>
<td>
<img src="http://placehold.it/100x100/ffcc00">
<img src="http://placehold.it/100x100/11cc00">
</td>
</tr>
<tr>
<td>
<img src="http://placehold.it/100x100/ffcc00">
</td>
</tr>
</table>
Example 5 - Old school with FLEXBOX
td {
display: flex;
padding: 0;
background-color: red;
}
table {
border-collapse: collapse;
}
<table>
<tr>
<td>
<img src="http://placehold.it/100x100/ffcc00">
<img src="http://placehold.it/100x100/11cc00">
</td>
</tr>
<tr>
<td>
<img src="http://placehold.it/100x100/ffcc00">
</td>
</tr>
</table>
Related
Ive been given a task to make the links (which are also images) go from 6 horizontal links, then collapsing them into 3 and then 3 on top of each other.
The catch here is its for en email template to be sent out. And although I have been making my template responsive, it only seems to go from 6 links in a horizontal line, to 6 links aligned vertically. No mini collapsing in between? Just straight horizontal, or straight vertical.
My main dilemma, is because this is for email, I am forced to do everything with inline CSS, something im not to keen on..
Ive tried using flex (obviously wont work) tried using different implementations of tables, but I cant get it to collapse in the desired manner...
Goal: To get it from going 6 horizontal, to collapsing to 3 and 3 on top of each other vertically. Any advice or help is greatly appreciated, thanks.
NOTE I only put 2 as there was no need to do it up to 6, but this is the usual approach I was taking
<center>
<table border="0" cellpadding="0" cellspacing="0" width="600" id="templateColumns">
<tr>
<td align="center" valign="top" width="50%" class="templateColumnContainer">
<table border="0" cellpadding="10" cellspacing="0" width="100%">
<tr>
<td class="leftColumnContent">
<img src="http://placekitten.com/g/480/300" width="280" style="max-width:280px;" class="columnImage" />
</td>
</tr>
</table>
</td>
<td align="center" valign="top" width="50%" class="templateColumnContainer">
<table border="0" cellpadding="10" cellspacing="0" width="100%">
<tr>
<td class="rightColumnContent">
<img src="http://placekitten.com/g/480/300" width="280" style="max-width:280px;" class="columnImage" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
<style type="text/css">
#media only screen and (max-width: 640px){
.templateColumnContainer{
display:block !important;
width:100% !important;
}
}
</style>
Here is the resolution to your problem using flex and having divs. I don't see the need of nested tables.
Js Fiddle Link
Html
<div class="container">
<div class="inner-container">
<div class="element">
<img src="whatever" alt="Fragrances"/>
</div>
<div class="element">
<img src="whatever" alt="Wicks"/>
</div>
<div class="element">
<img src="whatever" alt="Vessels"/>
</div>
</div>
<div class="inner-container">
<div class="element">
<img src="whatever" alt="Wax"/>
</div>
<div class="element">
<img src="whatever" alt="Kits"/>
</div>
<div class="element">
<img src="whatever" alt="Diffusers"/>
</div>
</div>
</div>
And Styles:
.element {
padding: 5px;
border: 1px black solid;
}
.inner-container {
display:flex;
justify-content: center;
}
#media (max-width: 600px) {
.container {
display: block;
}
}
#media (min-width: 600px) {
.container {
display: flex;
justify-content: center;
}
}
Try float left and width 100% ...
THis is what got the closest success as flex WILL NOT work with email services, although it wasn't inline, the only aspect that wont work in terms of responsive email is:
#media (max-width: 600px) {
.non-flex-inner-container {
display: inline-block;
}
}
as this cannot be made inline to my knowledge..
Here is the closest success:
<style type="text/css">
.non-flex-container {
display: inline;
text-align: center;
width: 100%;
float: left;
}
.non-flex-inner-container {
display: inline;
text-align: center;
width: 100%;
}
.non-flex-element {
display: inline;
}
#media (max-width: 600px) {
.non-flex-inner-container {
display: inline-block;
}
}
</style>
<div class="non-flex-container">
<div class="non-flex-inner-container">
<div class="non-flex-element">
<img src="img" alt="" width="100" height="10" style="margin:10px;"/>
</div>
<div class="non-flex-element">
<img src="img" alt="" width="50" height="10" style="margin:10px;"/>
</div>
<div class="non-flex-element">
<img src="img" alt="" width="70" height="10" style="margin:10px;"/>
</div>
</div><br>
<div class="non-flex-inner-container">
<div class="non-flex-element">
<img src="img" alt= width="40" height="10" style="margin:10px;"/>
</div>
<div class="non-flex-element">
<img src="img" alt="" width="40" height="10" style="margin:10px;"/>
</div>
<div class="non-flex-element">
<img src="img" alt="" width="100" height="10" style="margin:10px;"/>
</div>
</div>
</div>
This was complete success in terms of email and inline css, HOWEVER I was only able to achieve this with AMP pages, and apparently email services arent able to freely send amp pages unless said person whitelists you... Which completely defeats the purpose regardless...
width:100%; float:left;">
<div class="non-flex-inner-container" style="display:inline; text-align:center; width:100%;">
<div class="non-flex-element" style="display:inline;">
<amp-img src="img" alt="" width="100" height="10" style="margin:10px;" media="(min-width: 600px)" /></amp-img>
</div>
<div class="non-flex-element" style="display:inline;">
<amp-img src="img" alt="" width="50" height="10" style="margin:10px;" media="(min-width: 600px)"/></amp-img>
</div>
<div class="non-flex-element" style="display:inline;">
<amp-img src="img" alt="" width="70" height="10" style="margin:10px;" media="(min-width: 600px)"/></amp-img>
</div>
</div>
<div class="non-flex-inner-container" style="display:inline; text-align:center; width:100%;">
<div class="non-flex-element" style="display:inline;">
<amp-img src="img" alt="" width="40" height="10" style="margin:10px;" media="(min-width: 600px)"/></amp-img>
</div>
<div class="non-flex-element" style="display:inline;">
<amp-img src="img" alt="" width="40" height="10" style="margin:10px;" media="(min-width: 600px)"/></amp-img>
</div>
<div class="non-flex-element" style="display:inline;">
<amp-img src="img" alt="" width="100" height="10" style="margin:10px;" media="(min-width: 600px)"/></amp-img>
</div>
</div>
<!-- Display Inline-block when less than 600px -->
<div class="non-flex-container" style="display:inline; text-align:center; width:100%; float:left;">
<div class="non-flex-inner-container" style="display:inline-block;" text-align:center; width:100%;">
<div class="non-flex-element" style="display:inline;">
<amp-img src="img" alt="" width="100" height="10" style="margin:10px;" media="(max-width: 600px)" /></amp-img>
</div>
<div class="non-flex-element" style="display:inline;">
<amp-img src="img" alt="" width="50" height="10" style="margin:10px;" media="(max-width: 600px)"/></amp-img>
</div>
<div class="non-flex-element" style="display:inline;">
<amp-img src="img" alt="" width="70" height="10" style="margin:10px;" media="(max-width: 600px)"/></amp-img>
</div>
</div>
<div class="non-flex-inner-container" style="display:inline-block;" text-align:center; width:100%;">
<div class="non-flex-element" style="display:inline;">
<amp-img src="img" alt="" width="40" height="10" style="margin:10px;" media="(max-width: 600px)"/></amp-img>
</div>
<div class="non-flex-element" style="display:inline;">
<amp-img src="img" alt="" width="40" height="10" style="margin:10px;" media="(max-width: 600px)"/></amp-img>
</div>
<div class="non-flex-element" style="display:inline;">
<amp-img src="img" alt="" width="100" height="10" style="margin:10px;" media="(max-width: 600px)"/></amp-img>
</div>
</div>
</div>
The conclusion... It isnt possible yet.... If anyone else has any more insight, please let me know. Big thanks to #Rustam Goygov for the insight and guidance!
I have a bunch of images that are right next to each other to form a navigation bar. There are no gaps so it looks like one image while being able to make certain areas of it clickable and others not. How do I make it so if the navigation bar is too long for the window it gets smaller instead of some of the images going on a new line?
HTML/CSS:
.navbar-button {
margin: 0;
padding: 0;
display: inline block;
text-align: center;
margin-left: auto;
margin-right: auto;
height: 10%;
}
<center>
<img src="Images/NavBar1.png" alt="" class="navbar-button" />
<a href="Home.html">
<img src="Images/NavBar2.png" alt="" class="navbar-button" />
</a>
<img src="Images/NavBar3.png" alt="" class="navbar-button" />
<a href="Information.html">
<img src="Images/NavBar4.png" alt="" class="navbar-button" />
</a>
<img src="Images/NavBar5.png" alt="" class="navbar-button" />
<img src="Images/NavBar6.png" alt="" class="navbar-button" />
<img src="Images/NavBar7.png" alt="" class="navbar-button" />
<a href="Schedule.html">
<img src="Images/NavBar8.png" alt="" class="navbar-button" />
</a>
<img src="Images/NavBar9.png" alt="" class="navbar-button" />
<a href="#" onClick="document.getElementById('id01').style.display='block'">
<img src="Images/NavBar10.png" alt="" class="navbar-button" />
</a>
<img src="Images/NavBar11.png" alt="" class="navbar-button" />
</center>
Instead of trying to prevent the linebreak with multiple images, you may want to take a look at the possibility to define clickable areas on a single image. You can define a map with different clickable areas. Take a look at the example below, where only the area around the text is actually clickable:
<img src="https://dummyimage.com/600x400/000/fff" usemap="#map">
<map name="map">
<area shape="rect" coords="100,150,500,250" href="#">
</map>
You can also define different shapes and sizes, for a better understanding, just take a look at the documentation
Please also note
If you define coordinates as pixels, this can lead to different clickable areas, if you resize the image. There is another question at StackOverflow, with a helpful discussion on how to create responsive image maps
I don't know if i got what you are trying to do but check this and let me if it works for you
jsfiddle link
<div class="my-navbar">
<center>
<img src="https://cdn.pixabay.com/photo/2015/07/25/08/03/the-button-859350_1280.png" alt="" class="navbar-button" />
<a href="Home.html">
<img src="https://cdn.pixabay.com/photo/2015/07/25/08/03/the-button-859350_1280.png" alt="" class="navbar-button" />
</a>
<img src="https://cdn.pixabay.com/photo/2015/07/25/08/03/the-button-859350_1280.png" alt="" class="navbar-button" />
<a href="Information.html">
<img src="https://cdn.pixabay.com/photo/2015/07/25/08/03/the-button-859350_1280.png" alt="" class="navbar-button" />
</a>
<img src="https://cdn.pixabay.com/photo/2015/07/25/08/03/the-button-859350_1280.png" alt="" class="navbar-button" />
<img src="https://cdn.pixabay.com/photo/2015/07/25/08/03/the-button-859350_1280.png" alt="" class="navbar-button" />
<img src="https://cdn.pixabay.com/photo/2015/07/25/08/03/the-button-859350_1280.png" alt="" class="navbar-button" />
<a href="Schedule.html">
<img src="https://cdn.pixabay.com/photo/2015/07/25/08/03/the-button-859350_1280.png" alt="" class="navbar-button" />
</a>
<img src="https://cdn.pixabay.com/photo/2015/07/25/08/03/the-button-859350_1280.png" alt="" class="navbar-button" />
<a href="#" onClick="document.getElementById('id01').style.display='block'">
<img src="https://cdn.pixabay.com/photo/2015/07/25/08/03/the-button-859350_1280.png" alt="" class="navbar-button" />
</a>
<img src="https://cdn.pixabay.com/photo/2015/07/25/08/03/the-button-859350_1280.png" alt="" class="navbar-button" />
</center>
</div>
.navbar-button {
margin: 0;
padding: 0;
display: block;
text-align: center;
margin-left: auto;
margin-right: auto;
height: 10%;
float:left;
width:200px;
}
Try this
.navbar-button {
margin: 0 10px !important;
padding: 0;
display: inline block;
text-align: center;
margin-left: auto;
margin-right: auto;
height: 10%;
}
I am trying to create multiple photo galleries on one page. I can get the first gallery to work but when I try to add a second gallery neither of the pictures work. Could someone help me out and see what I have wrong or am missing? Thank you!
HTML:
<div class="gallery" align="center" id="gal1" >
<div class="thumbnails" id="thumb1" >
<img onmouseover="preview1.src=img1.src" name="img1" src="flower.jpg" alt="" />
<img onmouseover="preview1.src=img2.src" name="img2" src="blue_light.jpg" alt="" />
<img onmouseover="preview1.src=img3.src" name="img3" src="paintwithlight/JPEG/yellow-blue.jpg" alt="" />
<img onmouseover="preview1.src=img4.src" name="img4" src="paintwithlight/JPEG/abstract.jpg" alt="" />
<img onmouseover="preview1.src=img5.src" name="img5" src="paintwithlight/JPEG/angelin.jpg" alt="" />
<img onmouseover="preview1.src=img6.src" name="img6" src="paintwithlight/JPEG/anna.jpg" alt="" />
<img onmouseover="preview1.src=img7.src" name="img7" src="paintwithlight/JPEG/butterfly.jpg" alt="" />
<img onmouseover="preview1.src=img8.src" name="img8" src="paintwithlight/JPEG/clash.jpg" alt="" />
<img onmouseover="preview1.src=img9.src" name="img9" src="paintwithlight/JPEG/craze.jpg" alt="" />
<img onmouseover="preview1.src=img10.src" name="img10" src="paintwithlight/JPEG/dolphin.jpg" alt="" />
<img onmouseover="preview1.src=img11.src" name="img11" src="paintwithlight/JPEG/greenswirl.jpg" alt="" />
<img onmouseover="preview1.src=img12.src" name="img12" src="paintwithlight/JPEG/halfcircle.jpg" alt="" />
<img onmouseover="preview1.src=img13.src" name="img13" src="paintwithlight/JPEG/mindblown.jpg" alt="" />
<img onmouseover="preview1.src=img14.src" name="img14" src="paintwithlight/JPEG/mystic.jpg" alt="" />
<img onmouseover="preview1.src=img15.src" name="img15" src="paintwithlight/JPEG/radiation.jpg" alt="" />
<img onmouseover="preview1.src=img16.src" name="img16" src="paintwithlight/JPEG/rainbow.jpg" alt="" />
<img onmouseover="preview1.src=img17.src" name="img17" src="paintwithlight/JPEG/stuckcircle.jpg" alt="" />
<img onmouseover="preview1.src=img18.src" name="img18" src="paintwithlight/JPEG/swirl.jpg" alt="" />
<img onmouseover="preview1.src=img19.src" name="img19" src="paintwithlight/JPEG/whitelight.jpg" alt="" />
<img onmouseover="preview1.src=img20.src" name="img20" src="paintwithlight/JPEG/zeus.jpg" alt="" />
</div>
<div class="preview1" align="center">
<img name="preview1" src="flower.jpg" alt=""/>
</div>
</div>
<div class="gallery" align="center" id="gal2" >
<div class="thumbnails" id="thumb2" >
<img onmouseover="preview2.src=img1.src" name="img1" src="nature/JPEG/apple.jpg" alt="" />
<img onmouseover="preview2.src=img2.src" name="img2" src="nature/JPEG/cig.jpg" alt="" />
<img onmouseover="preview2.src=img3.src" name="img3" src="nature/JPEG/deadflower.jpg" alt="" />
<img onmouseover="preview2.src=img4.src" name="img4" src="nature/JPEG/halfnhalf.jpg" alt="" />
<img onmouseover="preview2.src=img5.src" name="img5" src="nature/JPEG/leaf.jpg" alt="" />
<img onmouseover="preview2.src=img6.src" name="img6" src="nature/JPEG/liveflower.jpg" alt="" />
<img onmouseover="preview2.src=img7.src" name="img7" src="nature/JPEG/mush.jpg" alt="" />
<img onmouseover="preview2.src=img8.src" name="img8" src="nature/JPEG/mushroom.jpg" alt="" />
<img onmouseover="preview2.src=img9.src" name="img9" src="nature/JPEG/pumpkin.jpg" alt="" />
<img onmouseover="preview2.src=img10.src" name="img10" src="nature/JPEG/redflower.jpg" alt="" />
<img onmouseover="preview2.src=img11.src" name="img11" src="nature/JPEG/rocks.jpg" alt="" />
<img onmouseover="preview2.src=img12.src" name="img12" src="nature/JPEG/silo.jpg" alt="" />
<img onmouseover="preview2.src=img13.src" name="img13" src="nature/JPEG/tree.jpg" alt="" />
<img onmouseover="preview2.src=img14.src" name="img14" src="nature/JPEG/tree2.jpg" alt="" />
<img onmouseover="preview2.src=img15.src" name="img15" src="nature/JPEG/tree3.jpg" alt="" />
<img onmouseover="preview2.src=img16.src" name="img16" src="nature/JPEG/water.jpg" alt="" />
<img onmouseover="preview2.src=img17.src" name="img17" src="nature/JPEG/yellowflower.jpg" alt="" />
</div>
<div class="preview" align="center">
<img name="preview2" src="nature/JPEG/apple.jpg" alt=""/>
</div>
</div>
CSS:
.thumbnails img {
height: 80px;
border: 4px solid #555;
padding: 1px;
margin: 0 10px 10px 0;
}
.thumbnails img:hover {
border: 4px solid #00ccff;
cursor:pointer;
}
.preview1 img {
border: 4px solid #444;
padding: 1px;
width: 800px;
}
.thumbnails #thumb2 img {
height: 80px;
border: 4px solid #555;
padding: 1px;
margin: 0 10px 10px 0;
}
.thumbnails #thumb2 img:hover {
border: 4px solid #00ccff;
cursor:pointer;
}
.preview2 img {
border: 4px solid #444;
padding: 1px;
width: 800px;
}
The name attribute on an <img> tag is obsolete in HTML5 and should not be used in production.
→ Use data-* attribute instead.
align attribute is obsolete or nonstandard
→ Use style text-align:center; instead
Inline JavaScript makes developing hard and code maintenance a nightmare.
→ Place your JavaScript code into <script>, away from your HTML tags.
Here's an example how to easily create multiple hover-able galleries:
function hoverGal() {
var bigID = this.parentNode.dataset.targetid;
document.getElementById(bigID).src = this.dataset.big;
}
[].forEach.call(document.querySelectorAll("[data-big]"), function(thumb) {
thumb.addEventListener("mouseenter", hoverGal, false);
});
<div data-targetid="big1">
<img src="//placehold.it/100x60/0fb" data-big="//placehold.it/360x200/0fb" alt="">
<img src="//placehold.it/100x60/fb0" data-big="//placehold.it/360x200/fb0" alt="">
<img src="//placehold.it/100x60/b0f" data-big="//placehold.it/360x200/b0f" alt="">
</div>
<img id="big1" src="//placehold.it/360x200/0fb">
<div data-targetid="big2">
<img src="//placehold.it/100x60/bf0" data-big="//placehold.it/360x200/bf0" alt="">
<img src="//placehold.it/100x60/f0b" data-big="//placehold.it/360x200/f0b" alt="">
<img src="//placehold.it/100x60/0bf" data-big="//placehold.it/360x200/0bf" alt="">
</div>
<img id="big2" src="//placehold.it/360x200/bf0">
That way you won't get into collision having duplicate thumbnails names / IDs or having to invent tons of different names.
I want to make a navigation bar, with each item having its own image with the name of the item written on top of that. So there should be a few images in a row, and each one has some text written on it. This is the row of images I got:
<div class="navigation" align="center">
<img src="images/bn_blue.png" width="120" height="70" alt="" />
<img src="images/bn_blue.png" width="120" height="70" alt="" />
<img src="images/bn_blue.png" width="120" height="70" alt="" />
<img src="images/bn_blue.png" width="120" height="70" alt="" />
<img src="images/bn_blue.png" width="120" height="70" alt="" />
<img src="images/bn_blue.png" width="120" height="70" alt="" />
</div>
<div class="navigation" align="center">
<ul><li><div style="background-image:url(images/bn_blue.png);width:120px;height:70px">xyz</div></li>
<li><div style="background-image:url(images/bn_blue.png);width:120px;height:70px">xyz</div></li>
<li><div style="background-image:url(images/bn_blue.png);width:120px;height:70px">xyz</div></li>
<li><div style="background-image:url(images/bn_blue.png);width:120px;height:70px">xyz</div></li>
<li><div style="background-image:url(images/bn_blue.png);width:120px;height:70px">xyz</div><li>
</ul>
</div>
<style>
li
{
display:inline-block;
}
</style>
Give each a href a class ie .home_bg etc.
Then in css add a
.home_bg {
background-image: url(/example/example.png)
}
do this for each image if they are different. Then in the html remove img tags
I've got this Div slide which makes your div box change to another div box.
The problem is when I zoom in or out, or when Chromes message pops up, the box where it asks you if you want the webpage translated. I've tried many things but it still moves :/ I think the problem is with the CSS, but as I said, I don't know where the problem is :(
Picture of the problem:
CSS:
#wrapper {
width:960px;
height: 750px;
margin-top: 30px;
overflow:hidden;
position:absolute;
}
#mask {
width: 500%;
}
.item {
width:20%;
height:100%;
float:left;
}
.content {
width:100%;
height:750px;
margin:0 auto;
margin-top: 20px;
}
.content a{
color:#F00;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
text-decoration:none; }
.selected {
font-weight:700;
}
.clear {
clear:both;
}
HTML:
<div id="wrapper">
<div id="mask">
<div id="item1" class="item">
<a name="item1"></a>
<div class="content">
<img src="Images/testknapp.png" />
<img src="Images/testknapp1.png" />
<table class="album">
<tr>
<td height="130" width="420" class="tdcontent"><span class="volt"> <img src="Images/buy/voltex.jpg" class="voltexpic" /></span> <div class="toltex"><h2 class="toltexh2">toltex - beliel</h2><p class="available">available now on itunes & beatport!</p><table class="toltexitunes"><tr><td class="toltexbuy" width="200"> <img src="Images/knapp.png" class="toltexitunesbutton" /> </span></td><td class="toltexbuy"><a href="http://www.beatport.com/release/beliel/1094237"> <img src="Images/knapp_beatport.png" class="toltexbutton" /> </td></tr></table></div></td>
<td height="130" width="420" class="tdcontent"><span class="volt"> <img src="Images/buy/noize.jpg" class="noizepic" /></span> <div class="toltex"><h2 class="noizeh2">noize - nothing special</h2><p class="available">available now on itunes & beatport!</p><table class="noizeitunes" height="30"><tr><td class="noizebuy"> <img src="Images/knapp.png" class="noizeitunesbutton" /> </td><td class="noizebuy"><a href="#"> <img src="Images/knapp_beatport.png" class="noizebeatportbutton" /> </td></tr></table></div></span> </td>
</tr>
<tr>
<td height="130" width="420" class="tdcontent"><span class="volt"> <img src="Images/buy/dubwood.jpg" class="dubwood" /></span> <div class="toltex"><h2 class="dubwoodh2">Dubwood - Beatz for streetz</h2><p class="available">available now on itunes & beatport!</p><table class="dubwooditunes"><tr><td class="dubwoodbuy"> <img src="Images/knapp.png" class="dubwooditunes" /> </td><td class="dubwoodbuy"> <img src="Images/knapp_beatport.png" class="dubwoodbeatport" /> </td></tr></table>
<td height="130" width="420" class="tdcontent"> <span class="volt"> <img src="Images/buy/metaphix.jpg" class="metaphixpic" /></span> <div class="toltex"><h2 class="metaphixh2">metaphix - facets</h2><p class="available">available now on itunes & beatport!</p><table class="metaphix"><tr><td class="metaphixbuy"> <img src="Images/knapp.png" class="metaphixitunes" /> </td><td class="metaphixbuy"> <img src="Images/knapp_beatport.png" class="metaphixbeatport" /> </td></tr></table></td>
</tr>
<tr>
<td height="130" width="420" class="tdcontent"><span class="volt"> <img src="Images/buy/dtsk.jpg" class="voltexpic" /></span> <div class="toltex"><h2 class="toltexh2">lök - i'm a dtsk lover</h2><p class="available">available now on itunes & beatport!</p><table class="toltexitunes"><tr><td class="toltexbuy" width="200"> <img src="Images/knapp.png" class="toltexitunesbutton" /> </span></td><td class="toltexbuy"><a href="http://www.beatport.com/release/beliel/1094237"> <img src="Images/knapp_beatport.png" class="toltexbutton" /> </td></tr></table></div></td>
<td height="130" width="420" class="tdcontent"><span class="volt"> <img src="Images/buy/strobe.jpg" class="noizepic" /></span> <div class="toltex"><h2 class="noizeh2">toltex - strobe</h2><p class="available">available now on itunes & beatport!</p><table class="noizeitunes" height="30"><tr><td class="noizebuy"> <img src="Images/knapp.png" class="noizeitunesbutton" /> </td><td class="noizebuy"><a href="#"> <img src="Images/knapp_beatport.png" class="noizebeatportbutton" /> </td></tr></table></div></span> </td>
</tr>
<tr>
<td height="130" width="420" class="tdcontent"><span class="volt"> <img src="Images/buy/gohard.jpg" class="dubwood" /></span> <div class="toltex"><h2 class="dubwoodh2">Toltex - go hard</h2><p class="available">available now on itunes & beatport!</p></br><table class="dubwooditunes"><tr><td class="dubwoodbuy"> <img src="Images/knapp.png" class="dubwooditunes" /> </td><td class="dubwoodbuy"> <img src="Images/knapp_beatport.png" class="dubwoodbeatport" /> </td></tr></table>
<td height="130" width="420" class="tdcontent"> <span class="volt"> <img src="Images/buy/ineedu.jpg" class="metaphixpic" /></span> <div class="toltex"><h2 class="metaphixh2">crypehead - i need u</h2><p class="available">available now on itunes & beatport!</p><table class="metaphix"><tr><td class="metaphixbuy"> <img src="Images/knapp.png" class="metaphixitunes" /> </td><td class="metaphixbuy"> <img src="Images/knapp_beatport.png" class="metaphixbeatport" /> </td></tr></table></td>
</tr>
</table>
</div>
</div>
<div id="item2" class="item">
<a name="item2"></a>
<div class="content">
<img src="Images/testknapp1.png" />
<img src="Images/testknapp.png" />
<table class="album">
<tr>
<td height="130" width="420" class="tdcontent"><span class="volt"> <img src="Images/buy/rewind.jpg" class="voltexpic" /></span> <div class="toltex"><h2 class="toltexh2">toltex - rewind</h2><p class="available">available now on itunes & beatport!</p><table class="toltexitunes"><tr><td class="toltexbuy" width="200"> <img src="Images/knapp.png" class="toltexitunesbutton" /> </span></td><td class="toltexbuy"><a href="http://www.beatport.com/release/beliel/1094237"> <img src="Images/knapp_beatport.png" class="toltexbutton" /> </td></tr></table></div></td>
<td height="130" width="420" class="tdcontent"><span class="volt"> <img src="Images/buy/killerkraut.jpg" class="voltexpic" /></span> <div class="toltex"><h2 class="toltexh2">killerkraut - time to get rollin'</h2><p class="available">available now on itunes & beatport!</p><table class="killerkrauttable"><tr><td class="toltexbuy" width="200"> <img src="Images/knapp.png" class="toltexitunesbutton" /> </span></td><td class="toltexbuy"><a href="http://www.beatport.com/release/beliel/1094237"> <img src="Images/knapp_beatport.png" class="toltexbutton" /> </td></tr></table></div></td>
</tr>
<tr>
<td height="130" width="420" class="tdcontent"><span class="volt"> <img src="Images/buy/harbinger.jpg" class="voltexpic" /></span> <div class="toltex"><h2 class="toltexh2">oskri - harbinger</h2><p class="available">available now on itunes & beatport!</p><table class="toltexitunes"><tr><td class="toltexbuy" width="200"> <img src="Images/knapp.png" class="toltexitunesbutton" /> </span></td><td class="toltexbuy"><a href="http://www.beatport.com/release/beliel/1094237"> <img src="Images/knapp_beatport.png" class="toltexbutton" /> </td></tr></table></div></td>
<td height="130" width="420" class="tdcontent"><span class="volt"> <img src="Images/buy/philosophy.jpg" class="voltexpic" /></span> <div class="toltex"><h2 class="toltexh2">dubtheraphy - philosophy</h2><p class="available">available now on itunes & beatport!</p><table class="philosophy"><tr><td class="toltexbuy" width="200"> <img src="Images/knapp.png" class="toltexitunesbutton" /> </span></td><td class="toltexbuy"><a href="http://www.beatport.com/release/philosophy/1118970"> <img src="Images/knapp_beatport.png" class="toltexbutton" /> </td></tr></table></div></td>
</tr>
<tr>
<td height="130" width="420" class="tdcontent"><span class="volt"> <img src="Images/buy/anditgoes.jpg" class="voltexpic" /></span> <div class="toltex"><h2 class="toltexh2">crypehead - and it goes (like this)</h2><p class="available">available now on itunes & beatport!</p><table class="philosophy"><tr><td class="toltexbuy" width="200"> <img src="Images/knapp.png" class="toltexitunesbutton" /> </span></td><td class="toltexbuy"><a href="http://www.beatport.com/release/and-it-goes-like-this/1114352"> <img src="Images/knapp_beatport.png" class="toltexbutton" /> </td></tr></table></div></td>
</tr>
</table>
</div>
</div>
</div>
Do any of you have any idea what the problem could be? :)
change the position of #wrapper to relative and check..
if you need further help, please consider adding your entire style and html in JSFiddle.net. It will be easier for me to locate the actual error.