I'm new to css and I need to add a few additional pages using the existing design that was created by previous programmer in coldfusion. But when I applied footer.cfm at the end of my codes, the footer is displayed on the right side, not at the bottom of my form no matter what I did. It did not respond to html br or p tags.
I tried to googled and follow the w3schools.com p.test (see the line break css codes below), it did nothing.
p.test {
word-break: break-all;
}
The footer.cfm looks like this:
<br>
<hr>
<div class="FooterText">
xxxxxxxx.com Help Desk: xxx.xxx.xxxx | Copyright © 2008 xxxxxxx.com |
report website problem to webmaster#xxxxxxx.com
</div>
</body>
</html>
The css for footer looks like this:
.FooterText {font: 0.7em Book Antiqua, Georgia, Times New Roman, serif;
font-size: 12px; color: #4f4f4f; margin-left:-310;}
One of my page uses jquery tabs and inside each tab there is a form, my codes look like this:
//Edit the counter/limiter value as your wish
var count2 = "500"; //Example: var count = "175";
function limiter2() {
var tex2 = document.myform.meetingschedule.value;
var len2 = tex2.length;
if (len2 > count2) {
tex2 = tex2.substring(0, count2);
document.myform.meetingschedule.value = tex2;
return false;
}
document.myform.limit2.value = count2 - len2;
}
ul.tabs {
margin: 0;
padding: 0;
float: left;
list-style: none;
height: 32px;
border-bottom: 1px solid #999999;
border-left: 1px solid #999999;
width: 800;
}
ul.tabs li {
float: left;
margin: 0;
cursor: pointer;
padding: 0px 21px;
height: 31px;
line-height: 31px;
border: 1px solid #999999;
border-left: none;
font: Georgia, Times New Roman, serif;
font-weight: bold;
color: #454545;
font-size: 0.8em;
background: #EEEEEE;
overflow: hidden;
position: relative;
}
ul.tabs li:hover {
background: #CCCCCC;
}
ul.tabs li.active {
background: #FFFFFF;
border-bottom: 1px solid #FFFFFF;
}
.tab_container {
border: 1px solid #999999;
border-top: none;
clear: both;
float: left;
width: 800;
background: #FFFFFF;
}
.tab_content {
padding: 20px;
font-size: 1.2em;
display: none;
}
<div class="tab_container">
<!--- The Tab container holder --->
<div id="tab1" class="tab_content">
content of first tab, form1
</div>
<div id="tab2" class="tab_content">
content of second tab, form 2
</div>
<div id="tab3" class="tab_content">
content of third tab. form 3
</div>
</div>
<p class="test">
<cfinclude template="footer.cfm">
</p>
When I put footer.cfm at the end of the last div tag, the footer does not go beneath the form tabs even after using the w3schools.com. It shows up at the right side of the form tab instead.
It looks like the problem is caused by the float:left on your tab_container.
Try this:
p.test { clear:left; }
and it should fix your problem
You may also want to change that p into div as it looks like you are inserting other divs inside it (and divs cannot be children of ps)
It looks like the problem is caused by the float:left on your tab_container.
Try this:
p.test { clear:left; }
and it should fix your problem
Related
I want the yellow div to just be tall enough and only reach the very bottom part of the letter g.
After adding a list it seems to not work despite having 0 padding or margin and displaying as an inline-block.
Also there shouldn’t be a gap between the green list and ‘get a quote’ orange section.
To summarise, I want to get rid of the yellow (well still be there but behind the other colours), and shift the green up to be just under the orange.
#footer-right {
float: left;
width: 360px;
height: 200px;
background: #96F;
}
.footer-text-section-wrap {
background: #ff0;
width: auto;
height: auto;
display: inline-block;
}
f1 {
color: #333;
font-weight: 100;
font-family: verdana, arial, "Times New Roman", Times, serif, georgia, serif, helvetica;
font-size: 20px;
border-bottom: 1px solid #ccc;
padding: 0 0 10px 0px;
background: #FCC;
}
ul.footer {
list-style-type: none;
padding: 0px;
color: #666;
font-weight: 100;
font-family: verdana, arial, "Times New Roman", Times, serif, georgia, serif, helvetica;
font-size: 20px;
background: #0CC;
}
<div id="footer-right">
<div class="footer-text-section-wrap">
<f1>Get a Quote</f1>
<ul class="footer">
<li>About</li>
<li>Contact</li>
<li>Outsourcing</li>
</ul>
</div>
</div>
Add a margin reset to remove unwanted gaps between elements. Something like this: * {margin:0}. This rule resets the margins applied by the browser to all properties. Or you could simply target the ul with ul.footer {margin:0}.
Then add padding-top: 10px to the ul to compensate for the padding-bottom: 10px on the f1 above. OR, add display: block to the f1.
The reason the padding-bottom on the f1 doesn't simply push down the ul is because the f1 is a custom element. As such, it has no basic styles applied by the browser and CSS properties fallback to initial values. The initial value of the display property is inline.
An inline box cannot grow in height. Hence, the padding-bottom:10px simply overlaps the line box, intruding into the element below. By changing the display to block, the f1 will act like a normal block element and push away the ul.
* { margin: 0; }
f1 { display: block; }
#footer-right {
float: left;
width: 360px;
height: 200px;
background: #96F;
}
.footer-text-section-wrap {
background: #ff0;
width: auto;
height: auto;
display: inline-block;
}
f1 {
color: #333;
font-weight: 100;
font-family: verdana, arial, "Times New Roman", Times;
font-size: 20px;
border-bottom: 1px solid #ccc;
padding: 0 0 10px 0px;
background: #FCC;
}
ul.footer {
padding: 0;
list-style-type: none;
color: #666;
font-weight: 100;
font-family: verdana, arial, "Times New Roman", Times;
font-size: 20px;
background: #0CC;
}
<div id="footer-right">
<div class="footer-text-section-wrap">
<f1>Get a Quote</f1>
<ul class="footer">
<li>About</li>
<li>Contact</li>
<li>Outsourcing</li>
</ul>
</div>
</div>
More information: Proper way to apply CSS to HTML5 custom elements
This is a quick resolution using margin changes to remove the yellow space like you asked. Remember you can inspect elements and see where space is being created by highlighting the element's markup then viewing the diagram shown normally on the bottom left of the window.
#footer-right{
float:left;
width:360px;
height:200px;
background:#96F;
}
.footer-text-section-wrap{
background:#ff0;
width:auto;
height:auto;
display: inline-block;
}
f1{
color:#333;
font-weight:100;
font-family:verdana,arial,"Times New Roman", Times, serif,georgia,serif,helvetica;
font-size:20px;
border-bottom:1px solid #ccc;
padding:0 0 10px 0px;
margin: 0 0 10px 0px;
background:#FCC;
}
ul.footer {
list-style-type:none;
padding: 0px;
margin: 10px 0 0 0; /*This is all that I added or changed*/
color:#666;
font-weight:100;
font-family:verdana,arial,"Times New Roman", Times, serif,georgia,serif,helvetica;
font-size:20px;
background:#0CC;
}
<div id="footer-right">
<div class="footer-text-section-wrap">
<f1>Get a Quote</f1>
<ul class="footer">
<li>About</li>
<li>Contact</li>
<li>Outsourcing</li>
</ul>
</div>
</div>
<ul> have default margins (20px on top and bottom), you should add margin: 0; to your ul.footer styles to remove the extra yellow created by the margins.
You have no margin in your ul.footer..
First Option.. You can just do margin:0px; in your ul.footer.
Second Option.. You can take out the yellow background, and do margin-top:-10px; in your ul.footer.
(Not the actual negative number.. That is just guesstimating.)
Either one works, but the first option is easiest and less painful.
I have a pretty specific question: I'm building something like a simple flat table (I don't use table itself because of rounded borders issue).
I'm using unordered list here and the problem is that I can't figure out how to align items in the second column, taking into account that the content should be dynamic (e.g. changing numbers).
Here's the markup for one row:
<section class="ktbl_head">
<ul>
<li>VALUE</li>
<li>VALIDITY</li>
</ul>
</section>
<section class="ktbl_mid_wht">
<ul>
<li>500 units</li>
<li>15 days</li>
<button class="btn btn-sm getdramz pull-right">GET</button>
</ul>
</section>
And CSS:
.ktbl_head {
padding: 15px 0 0 0;
height: 100%;
background-color: #ebe7e7;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.ktbl_head ul li {
display: inline;
padding-right: 135px;
font-family: "Open Sans", sans-serif;
font-size: 14px;
font-weight: 300;
color: #888888;
}
.ktbl_mid_wht {
background-color: #ffffff;
height: 100%;
padding: 20px 0 0 0;
}
.ktbl_mid_wht ul li {
display: inline;
text-align: left;
padding-right: 90px;
font-family: "Open Sans", sans-serif;
font-size: 18px;
font-weight: 400;
color: #888888;
}
Thanks for your attention!
here is my implementation on aligning the table without the table tag:
HTML
<div class="container">
<section class="ktbl_head">
<ul>
<li>VALUE</li>
<li>VALIDITY</li>
</ul>
</section>
<section class="ktbl_mid_wht">
<ul>
<li>500 units</li>
<li>15 days</li>
<button class="btn btn-sm getdramz pull-right">GET</button>
</ul>
</section>
CSS
.container {
border-radius: 10px;
border: 1px solid rgb(200,200,200);
overflow: hidden;
}
section {
font-family: "Open Sans", sans-serif;
width: 100%;
}
section:nth-child(2n+1) {
background-color: #ebe7e7;
}
section ul {
padding: 0;
margin: 0;
height: 65px;
}
section ul li {
width: 45%;
line-height: 65px;
display: inline-block;
}
section ul li:first-child {
padding-left: 35px;
}
Result
Explanation
You see, in the HTML, I added a new div as a container to create the curved corner with border-radius (the overflow: hidden needs to be used so that the content is encapsulated by the container).
For the CSS, section maintains general property such as font-family. Furthermore, section:nth-child(2n+1) is used to create background-color every other element starting with 1st,3rd,5th,... element. The selectors section ul, section ul li, and section ul li:first-child are used to make the CSS selectors more semantic (it makes clean code and easy to maintain in the future). Please see the code below for the demo. Happy coding!
PLAYGROUND
Give all the li's a width in which all of the content-length will fit..
I am trying to float my logo to the left in the header but it doesn't float to left at all. I would really appreciate if someone could point our my error since I am new to CSS.
This is my website if you would like to see my problem live: http://cashski.com/
Here is my HTML code:
<div id="navigation">
<div class="center_navigation">
Contact
Instagram Followers
Instagram Photo Likes
<img src="img/logo.png" />
</div>
</div>
Here is my CSS code:
body {
padding: 0px;
margin: 0px;
font-family: Optima, Segoe, "Segoe UI", Candara, Calibri, Arial, sans-serif;
}
#navigation{
width: 100%;
height: 50px;
margin: 0px auto;
position: relative;
background-color: #2d5b89;
border-bottom: 1px solid #244a75;
}
.center_navigation {
width: 960px;
height: 50px;
margin:0px auto;
font-size: 16px;
}
.center_navigation a {
padding: 10px 0 10px 30px;
float: right;
margin-top: 4px;
color: #babcc5;
text-decoration: none;
}
.center_navigation a:hover {
color: white;
}
.center_navigation a img {
float: left;
}
The problem is your all anchor tags are float:right and your image is inside a anchor tag, so making img float:left doesn't change much.
So you either need to put the style on the container of image ie. anchor tag like this
<a href="index.php" style="float: left;">
<img src="img/logo.png">
</a>
or if your image is always in last anchor tag then you can also use this
.center_navigation a:last-child{
float: left;
}
Js Fiddle Demo
I am implementing a very simple css menu. However, if I select a menu title in the menu bar (and thus open the menu associated with it) the width of the title extends to the width of the menu, which is not desired (i.e. the width of the title should not change). Check out the JSFiddle, or have a look at the markup:
<div id="menu">
<ul>
<li>you
<ul>
<li>register...</li>
<li>login...</li>
<li>forgot password...</li>
</ul>
</li>
<li>.</li>
<li>qan</li>
<li>.</li>
<li style="width: 20px"><a class="site">be</a>
<ul>
<li>be</li>
<li>do</li>
</ul>
</li>
</ul>
</div>
and the css definitions:
#menu {
font-family: Arial, Helvetica, sans-serif;
padding: 0px 5px;
font-size: 12px;
line-height: 18px;
color: darkgrey;
position: absolute;
top: 0px;
left: 0px;
height: 20px;
background-color: black;
z-index: 3;
/*opacity: 0;*/
white-space: nowrap;
}
#menu ul {
margin: 0px;
padding: 0px;
list-style-type: none;
list-style-image: none;
}
#menu>ul>li {
font-weight: bold;
display: inline-block;
float: left;
padding: 2px 1px 0px 1px;
width: auto;
/*width: 10px;*/
}
#menu a { color: inherit; text-decoration: none;}
#menu>ul>li>a:hover { background-color: grey;}
#menu>ul ul {
display: none;
background-color: lightgrey;
padding: 2px 5px;
line-height: 14px;
min-width: 100px;
}
#menu>ul ul>li {
color: black;
padding: 2px 8px 2px 5px;
margin: 0px -3px;
}
#menu>ul ul>li:hover { color: lightgrey; background-color: grey;}
#menu>ul>li:hover ul { display: block;}
Since the menus are generated dynamically and contents meant to change on the fly and the font used is proportional, I cannot just set the widths of a title to a constant value which suppresses the resize. The width of the title should be determinded solely by the width of the text.
It used to work when I had implemented yuimenus, but that did all kinds of stuff to my CSS, the ramifications of which I found hard to control, so now I cooked up the menu by myself and am quite happy with it, save for the width change, and I haven't figured out which part of yui suppressed that. Any suggestions?
I don't agree with max-width.. this will make the link's width content-independent
use position:absolute; for the submenu: jsFiddle
Set width in li
Your updated example :- http://jsfiddle.net/8U5An/8/
Css:-
#menu ul li {
width: 25px;
}
See some useful example as well , how they handle same case by using width only :-
http://www.diy.com/diy/jsp/index.jsp?noCookies=false
http://www.puregrips.com/
My apologies if this too basic of a question but CSS is boggling me. I think I'm doing something that CSS is supposed to do easily but it is simply not working the way I read the documentation.
Here's my example. It's been massively simplified but the basic problem remains. I'm sure this is some core misconception on my part, I just don't know where it lies.
Here's the goal:
Here's what I get now:
Here is the HTML:
<div id="line-wrapper">
<div id="block-nice-menus-1">
<ul id="nice-menu-1">
<li><span title="Departments" class="nolink">Departments</span>
</li>
</ul>
</div>
<div id="block-imageblock-40">
<img src="http://www.kallenconsulting.com/home/files/top-menu-swish.png"
alt="" />
</div>
<div id="block-imageblock-42">
<img src="http://www.kallenconsulting.com/home/files/Transparent-4x6.png"
alt="" />
</div>
</div>
And here's the CSS:
/* -- nice-menu-1 is Main Menu -- */
#line-wrapper {
background-color: #ff0000;
}
#block-nice-menus-1 {
position: relative;
float: right;
margin-right: 0px;
height: 40px;
border: none;
background: #d6b982;
}
#nice-menu-1 {
display: block;
padding: 0px 30px;
border-top: none;
border-bottom: none;
color: #000;
background: #d6b982;
line-height: 2.4em;
font-weight: bold;
font-family: Helvetica, Arial, Sans-Serif;
text-transform:uppercase;
text-decoration: none;
}
#nice-menu-1 ul, #nice-menu-1 li {
border-top: none;
border-bottom: none;
border-color: #e11837;
}
#block-imageblock-40 {
/* top-menu-swish */
float: right;
margin: 0px;
}
#block-imageblock-42 {
/* top-menu-leading-line */
bottom: 0px;
height:6px;
width:100%;
background: #d6b982;
}
I can't get the floats right (I know, Yet Another Float Question). The main issue is that this is going to be a menu with a variable number of items, so as the menu grows, ("Departments" now, but later "Departments", "Services", "Sections", etc.) it should push to the left, reducing the length of the line I can't use a fixed length on the leading line (#block-imageblock-42). Also, the menu items will have separators, so I can't just full-width things. This needs to be done in pure CSS, no jQuery or other JS.
Here's my JSfiddle of the problem: http://jsfiddle.net/zjfsy/
UPDATE: I have modified the question to be more specific per the requests of folks trying to help. The "goal" image at the top has been updated to more accurately reflect the issue. One thing I really want to make clear is that this specific instance is not so important. I already doctored up a position:absolute fix that will hold for the short term. My desire is to understand better why this is so hard. I have three containers. I want two of them to float right and the third to expand to fill the space from the last container to the edge of the page. It seems like this is what float was supposed to do. I assume this is some base misunderstanding on my part.
Anyway. Here's more constraints:
The leading bar needs to expand to fill the empty space between the
left side and the swish.
Each of the tabs needs to have a separator that allows the background through.
The number of the tabs is variable, based on client choices -- which
can change regularly.
I can't really change the structure of the HTML, other than
modifying it with CSS.
And again, all help is very much appreciated.
here is my solution: http://jsfiddle.net/abbood/b56Vq/ (never used jsfiddle before.. so sorry if i did this wrong, or if i was supposed to fork your project)
here is the code:
<html>
<head>
<link href="betterStyle.css" rel="stylesheet">
</head>
<body>
<div id="wrapper">
<ul>
<li><div></div><div>Departments</div></li>
<li><div></div><div>Services</div></li>
<li><div></div><div>Sections</div></li>
<li><div></div><div>stuff</div></li>
</ul>
</div>
</body>
</html>
//betterStyle.css
#wrapper {
height: 2.5em;
background-color: #e0203b;
background-image: url('http://s11.postimage.org/a1jmymlgv/bage_Box.png');
background-position: bottom;
background-repeat: repeat-x;
}
ul
{
list-style-type: none;
float: right;
margin: 0;
padding: 0;
}
ul li {
float: right ;
display: inline-block;
}
/* text */
ul li div:nth-child(2) {
line-height: 2.5em;
line-weight: bold;
font-family: Helvetica, Arial, Sans-Serif;
text-transform: uppercase;
background-color: #d6b982;
float: right;
padding-right: 1em;
}
/* image */
ul li div:nth-child(1) {
background-image: url('http://s8.postimage.org/b2qycoatd/top_menu_swish.png');
background-position: left top;
background-repeat: no-repeat;
float: left;
width: 53px;
height: 40px;
line-weight: bold;
font-family: Helvetica, Arial, Sans-Serif;
text-transform: uppercase;
}
notes:
i created my own image and I linked to it using some image hosting service.
you can add as many tabs as you want (i assumed that each tab will have that image attached to it.. i wasn't sure how you wanted the final thing to look like (the right edges look too sharp).. but i'm sure you can adjust it to your liking.. when adding extra tabs the horizontal line shrinks.. i think that's what you meant when you said so as the menu grows, it should push to the left, reducing the length of the line
update:
Here is the updated answer without changing a line in the html: http://jsfiddle.net/abbood/SkxkC/ (for some reason there is a bump under the folder image in jsfiddle.. i tested it on mac chrome/safari/firefox and they worked fine.. lemme know if it isn't working perfectly for you though)
html (pretty much same.. just added a couple of tabs just for fun):
<body>
<div id="line-wrapper">
<div id="block-nice-menus-1">
<ul id="nice-menu-1">
<li><span title="Departments" class="nolink">Departments</span>
</li>
<li><span title="Departments" class="nolink">Services</span>
</li>
<li><span title="Departments" class="nolink">Classes</span>
</li>
</ul>
</div>
<div id="block-imageblock-40">
<img src="http://www.kallenconsulting.com/home/files/top-menu-swish.png"
alt="" />
</div>
<div id="block-imageblock-42">
<img src="http://www.kallenconsulting.com/home/files/Transparent-4x6.png"
alt="" />
</div>
</div>
</body>
css:
/* -- nice-menu-1 is Main Menu -- */
#line-wrapper {
background-color: #ff0000; /* red */
height: 40px;
position: relative;
z-index: -2;
}
#line-wrapper div {
background-color: #ff0000; /* red */
}
#block-nice-menus-1 {
position: relative;
float: right;
margin-right: 0px;
height: 40px;
border: none;
background: #d6b982;
}
#nice-menu-1 {
display: block;
border-top: none;
border-bottom: none;
color: #000;
line-height: 2.4em;
font-weight: bold;
font-family: Helvetica, Arial, Sans-Serif;
text-transform:uppercase;
text-decoration: none;
margin: 0;
padding: 0;
}
#nice-menu-1 ul {
padding: 0;
background-color: #ff0000; /* red */
}
#nice-menu-1 ul, #nice-menu-1 li {
border-top: none;
border-bottom: none;
border-color: #e11837;
}
#nice-menu-1 li{
list-style-type: none;
display: inline-block;
padding: 0 2em;
background: #d6b982; /* bage */
height: 40px;
}
#block-imageblock-40 {
/* top-menu-swish */
float: right;
margin: 0px;
}
#block-imageblock-42
{
/* top-menu-leading-line */
bottom: 0px;
height:6px;
width:100%;
background-color: #d6b982 !important;
position: absolute;
z-index: -1;
}
I a have also done something similar that does not use the position:relative feature for the #line-wrapper since that may cause you some problems when you implement it.
See http://jsfiddle.net/zjfsy/
#block-imageblock-42 {
/* top-menu-leading-line */
height:6px;
width:100%;
background: #d6b982;
position:absolute;
margin-top:34px;
}
#line-wrapper {
display: block;
height: 40px;
width: 100%;
background-color: #ff0000;
}
Hope this helps! (I am definitely going to vote wxactly's answer up since it is a better answer than mine since it doesn't require "hard coding" with magic number margins, etc. Definitely use his answer if you can, but now at least you have two different ways.