I'm designing my first website (for a start-up IT support company) and I have run into some issues in my learning. Problems are:
When I try to put a border around my nav element, it moves the nav box down the side to where it's still on the left, but below the the main (article?) section of the webpage. It also makes the border around my main header part thicker (only the side where the nav box is).
I cannot get the footer to align with the article section (even though both are supposed to be aligned to the center. I suspect the footer is not aligning because the nav box is changing the "center" alignment of the article).
P.S. I don't understand why this post is being downvoted into oblivion... I haven't found the answer to this question anywhere else, nor do I think it is a senseless one.
Here is the jsfiddle for my site: http://jsfiddle.net/EchoedTruth/a4CLL/
`$` <nav style="background-color: red">
<table>
<ul>
<tr>
<td><li><b>Home</b> </li></td>
</tr>
<tr>
<td> <li><b>Services We Offer</b></li>
</td>
</tr>
<tr>
<td>
<li><b>About Our Company</b></li>
</td>
</tr>
<tr>
<td>
<li><b>Testing Page</b></li>
</td>
</tr>
<tr><td><li><b>Testing Page 2</b></li></td></tr>
</ul>
</table>
</nav>
`$`
The code within your NAV element is invalid HTML.
You have this which is just all sorts of wrong:
<table>
<ul>
<tr>
<td><li><b>Home</b> </li></td>
</tr>
<tr>
<td> <li><b>Services We Offer</b></li>
</td>
</tr>
<tr>
<td>
<li><b>About Our Company</b></li>
</td>
</tr>
<tr>
<td>
<li><b>Testing Page</b></li>
</td>
</tr>
<tr><td><li><b>Testing Page 2</b></li></td></tr>
</ul>
</table>
Try changing it to this:
<nav>
<ul>
<li>Home</li>
<li>Services We Offer</li>
<li>About Our Company</li>
<li>Testing Page</li>
<li>Testing Page 2</li>
</ul>
</nav>
The reason your NAV element is moving out of place when you add a border will probably be because adding the border gives the NAV element a larger width.
e.g if your NAV element is 300px wide and you give it a border of 1px that will make the NAv element 302px.
Read up on the HTML Box Model to understand this better.
Your HTML structure is not correct, you have <li> within a <table>? <li> elements are only allowed withing a <ul> or <ol> elements. So I would fix your nav first before trying to style:
CSS:
ul {
border:1px solid #000; // border around all li elements
}
ul li {
border:1px solid #666; // border around each li element
}
HTML:
<nav style="background-color:red;">
<ul>
<li><b>Home</b></li>
<li><b>Services We Offer</b></li>
<li><b>About Our Company</b></li>
<li><b>Testing Page</b></li>
<li><b>Testing Page 2</b></li>
</ul>
</nav>
Related
How can you align the text of an anchor vertically?
I may or may not know the number of lines, so line-height trick can't be relied upon.
Hierarchy is as so: nav ul li a in
<nav>
<ul>
<li>Hello</li>
</ul>
</nav>
Hello must be centered but cannot be wrapped.
The a elements have display: inline-block
Following the solution explained in this thread: How to get display:table-cell support in IE? any pure javascript or jQuery workaround?
You can add some additional code to the list, and adjust the height of the block with the height of the td:
<nav>
<ul>
<li>
<table>
<tr>
<td>
Hello
</td>
</tr>
</table>
</li>
</ul>
</nav>
You can see it working here: http://jsfiddle.net/G4kCz/4/
So, Im currently trying to do this:
<table class ="tablez">
<tr>
<th>Table Title </th>
</tr>
<tr>
<td>
<a tabindex="0" class="clickable">Click Me!</a>
<div id="showedClickable">
<p>This is showed when Click Me! is clicked.</p>
</div><!--EO showedClickable -->
</td>
</tr>
</table>
Heres the class
#showedClickable {
position:absolute;
display:none;
width:auto;
height:auto;
}
Heres what happens when you click.
a.clickable:focus + #showedClickable {
display:block;
}
It works fine on chrome on a laptop but when I try this on a mobile(iPhone) this doesn't work....What's the issue here?? How can I work around this,solve this?
Thank you for your time!
I had simillar trouble to this. The problem is that the iPhone doesn't redraw siblings based on events in CSS.
Try nesting your elements like this and using a child selector rather than a sibling selector. It is also generally more semantic as the item you click is often a heading for what is shown.
Oddly enough the iPad supports hover as a click event,
<ul>
<li>Click me
<ul>
<li>This is showed when Click Me! is clicked.</li>
</ul>
</li>
li:hover ul {display: block;}
I have a div to the left of a page that contains links to different divs on the right. I want the left div to stay fixed when scrolling the page but also show next to the div I jump to. the problem is that when i click on a link it will jump to the div but the navigation div does not render until i mouse over it piece by piece and it seems to break the page. any ideas?
Navigation div
<div class="tableoutline fixed">
<table class="notableoutline glossary">
<thead>
</thead>
<tbody>
<tr>
<td class="datatd">
{{data.learn.recommendedQuestions.title}}
</td>
</tr>
<tr>
<td class="datatd">
{{process.title}}
</td>
</tr>
</tbody>
</table>
</div> <!-- End of tableoutline -->
content div
<div class="contentbox bottomMargin" id="process" name="process">
<h1>{{data.learn.process.title}}</h1>
<div class="questionsAndAnswers">
<h2>{{process.question1}}</h2>
<p>{{process.answer1}}</p>
</div>
</div> <!-- End of Content Box /-->
to make an element fixed:
#element {
position: fixed;
}
if you want it to be on top all the time, use z-index
here am getting font size,family,backbolor from database.
so that value am applyng to anchortags inside div tag.
except font size remaining working fine.
here is my code.
here am tryied two types .
1. applying font size to div tag.
2.applying font size to ul tags
<div id="sidenav" class="column" runat="server">
<table cellpadding="10" cellspacing="10">
<tr>
<td>
<ul id="abcd" runat="server">
<li>Events</li>
<li>Photo Galleries</li>
<li>Location</li>
<li>Officials</li>
<li>Honours Board</li>
<li>History</li>
<li>Links</li>
<li>Site map</li>
<li>Help</li>
</ul>
</td>
</tr>
</table>
</div>
panelLinks.Style.Add("background-color", objpage.MenuBackcolor);
panelLinks.Style.Add("color", objpage.MenuTextcolor);
panelLinks.Style.Add("font-family", objpage.MenuTextStyle);
//contanerwrapper.Style.Add("font-size", objpage.BodyTextSize);
//contanerwrapper.Style.Add("color", objpage.BodyTextBackcolor);
//contanerwrapper.Style.Add("font-family", objpage.BodyTextStyle);
abcd.Style.Add("background-color", objpage.NavigationBackcolor);
abcd.Style.Add("color", objpage.NavigatioinTextcolor);
abcd.Style.Add("font-family", objpage.NavigatioinTextStyle);
abcd.Style.Add("font-size", objpage.NavigatioinTextsize);
panelLinks.Style.Add("background-color", objpage.MenuBackcolor);
panelLinks.Style.Add("color", objpage.MenuTextcolor);
panelLinks.Style.Add("font-family", objpage.MenuTextStyle);
//contanerwrapper.Style.Add("font-size", objpage.BodyTextSize);
//contanerwrapper.Style.Add("color", objpage.BodyTextBackcolor);
//contanerwrapper.Style.Add("font-family", objpage.BodyTextStyle);
sidenav.Style.Add("background-color", objpage.NavigationBackcolor);
sidenav.Style.Add("color", objpage.NavigatioinTextcolor);
sidenav.Style.Add("font-family", objpage.NavigatioinTextStyle);
sidenav.Style.Add("font-size", objpage.NavigatioinTextsize);
Try to add code like
abcd.Style.Add("font-size", string.Format(objpage.NavigatioinTextsize+"px")) ;
You should need to specify the unit of measurement for font-size.
I have a site that generates related video's to a topic. I have 4 thumbnails and I want to add a css play button on the thumbnails, which can be done with this code: ► | It will be like this: http://i47.tinypic.com/250qis9.png
Here is a demo: http://jsfiddle.net/vtPhZ/2/
The problem is that it won't recognize the a:before tags that I gave it to. What am I doing wrong?
The HTML snippet which generates the list:
<div id="youtubeThumbs">
<ul class="ytlist">
<li>
<table cellspacing="3" cellpadding="3" border="0">
<tbody>
<tr>
<td valign="top" rowspan="2">
<a class="clip" style="cursor: pointer;">
<span>
<img src="http://i.ytimg.com/vi/1q47bOtV3-Y/hqdefault.jpg">
<em></em>
</span>
</a>
</td>
<td valign="top">
</tr>
</tbody>
</table>
</li>
And the CSS I tried to use (without success):
.ytlist li > a:before {
content: "►";
}
How can I make it work?
I can't explain why but for some reason your change of methods for declaring a child element is causing the problem. Using my first two recommendations of using the unicode entity for the content and using the pseudo element rather than the pseudo class, the CSS should work. However, it did not initially work. When I removed > from the first line the CSS worked.
Here's a demo: http://jsfiddle.net/vtPhZ/4/
Your method was strange but the fact that it didn't work was even more strange...