Changing scroll bar to the left of a div - html

I'm bulding a Wordpress site that has a "box" for the main article. This is build using CSS and several Divs around the article. This all works fine, the only problem is that when I need a scroll bar, it apears outside of the right box border.
See for yourself (with awesome perfect red circle around it!).
Basically, I want it to stay IN the article, so in the left side of the last image (the right side border). I read around the internet, and I found that you can reverse the scroll bar using dir="rtl", but that will reverse all the scroll bars, and thats not really what I want.
[EDIT - To make it clear, I don't want it in the left side of the article itself, just inside the box on the right side of the text. This is sort of what I want, but as you see, it messes up the article box. I want it sort of in that position, but without screwing up the article.]
[End edit]
This is the CSS (this comes from a modded template, so excuse me if there are obvious errors):
.article {
margin-bottom:20px;
}
.article-corps-title {
background:url(images/article_sprite.png) no-repeat;
background-position:0 -17px;
min-height:70px;
max-height:142px;
position:relative;
}
.page-corps-title {
display:block;
/*background:url(images/article_sprite.png) no-repeat;
background-position: 13px -65px;*/
background:url(images/articlebox.png) no-repeat;
background-position:15px 0px;
height:80px;
}
.article-top {
position:absolute;
top:13px;
right:25px;
}
.article-top a {
display:block;
font-size:10px;
font-weight:700;
color:#aaa;
text-decoration:none;
padding:4px 12px 0 0;
background:url(images/icons.png) no-repeat;
background-position:top right;
}
.article-date {
position:absolute;
left:11px;
top:26px;
display:block;
width:40px;
text-align:center;
}
.article-date .month {
font-size:13px;
font-weight:700;
line-height:15px;
color:#FFF;
text-transform:uppercase;
}
.article-date .day {
font-size:22px;
font-weight:700;
color:#FFF;
}
h2.page-title {
text-align:center;
font-size:26px;
font-weight:700;
padding-top:10px;
padding-bottom:15px;
color:#000000;
text-shadow:#CCC 0 0 2px;
max-width:565px;
}
h2.article-title {
font-size:26px;
font-weight:700;
margin-left:80px;
padding-top:30px;
color:#ce0709;
text-shadow:#CCC 0 0 2px;
max-width:565px;
}
h2.article-title a, h2.page-title a {
color:#ce0709;
text-decoration:none;
}
h2.article-title a:hover,h2.page-title a:hover {
color:#E00
}
.article-meta-autor {
font-size:11px;
color:#aaaaaa;
margin-left:80px;
background:url(images/icons.png) no-repeat;
background-position:left -15px;
padding:4px 0 4px 20px;
max-height:11px;
line-height:14px;
}
.article-meta-autor a, .article-meta-keywords a, .article-meta-comments a {
color:#aaaaaa;
text-decoration:none;
font-weight:700;
}
.article-meta-autor a:hover, .article-meta-keywords a:hover, .article-meta-comments a:hover {
text-decoration:underline;
}
.article-corps {
position:relative;
/*background:url(images/article_sprite.png) repeat-y;
background-position:-683px 0px;*/
background:url(images/articleboxmiddle.png) repeat-y;
background-position:-5px 0px;
/*min-height: 250px;*/
height:300px;
margin-left:20px;
padding:13px 43px 0px 50px;
line-height:20px;
overflow:auto;/*hidden;*/
}
.article-read-more {
margin:0px auto;
width:164px;
padding-bottom:15px;
}
.article-read-more a {
display:block;
width:156px;
height:26px;
text-align:center;
padding-top:9px;
background:url(images/read_more.png) no-repeat;
background-position:top left;
font-weight:700;
color:#FFF;
text-decoration:none;
text-transform:uppercase;
}
.article-read-more a:hover {
background-position:bottom left;
}
.article-meta-keywords {
position:absolute;
bottom:0;
left:50px;
background:url(images/icons.png) no-repeat;
background-position:0 -34px;
padding-left:20px;
font-size:11px;
color:#aaa;
max-height:20px;
max-width:450px;
overflow:hidden;
}
.article-meta-comments {
position:absolute;
bottom:0;
right:45px;
background:url(images/icons.png) no-repeat;
background-position:0 -54px;
padding-left:20px;
font-size:11px;
color:#aaa;
}
.article-meta-keywords a {
color:#aaa;
font-weight:700;
text-decoration:none;
}
.article-meta-keywords a:hover {
text-decoration:underline;
}
.article-footer {
display:block;
/*background:url(images/article_sprite.png) no-repeat;
background-position:14px -15px;*/
background:url(images/articlebox.png) no-repeat;
background-position:15px -420px;
height:45px;
}
Thank you.

use dir="rtl" to give direction to the text. The scrollbars will appear to the left.
Then use dir="ltr" to the inside elements such as p, div etc to nullify the effect. This way, dir="rtl"
Here is the fiddle - http://jsfiddle.net/ashwyn/dcLQQ/
I works in Firefox though, but in my chrome it doesn't.
[Edit]
Below is the fiddle to shift the scrollbar slightly to the left-
http://jsfiddle.net/ashwyn/fPGy8/1/
I don't think there is any other solution that you can fix apart from the above.

this is not a solution to your problem but just a suggestion:
be aware that you're going against the standard behaviour your users would expect - a scrollbar always appears on the right for left-to-right languages, and this could be bad usability. As you are not creating a site that requires RTL, it would be better to not change the standard browser behaviour.

You haven't given enough code (structure) for me to give a specific answer, but it looks as though you could just narrow the div that contains the article.

Related

Footer CSS not working

I set up some CSS styles for a HTML page and all was working as expected. I then edited the CSS (minimally) and suddenly the layout breaks. I've got a copy of the original (working) CSS so I could just go with that. But I wanted to sort out what I did wrong.
So, I've spent a few hours going over the faulty CSS but I just cannot find where it is incorrect. Hoping someone can point out the mistake.
In both cases the HTML is the same.
I've created 2 CodePens, one with working HTML/CSS, the other with same HTML and faulty CSS. The problem is in the footer area. With the faulty CSS, the 'bottom bar' rides up into the main footer above. However, I think I've cleared floats correctly.
Below is what I think is the faulty section of CSS (but it will make more sense to view it along with HTML - see CodePen links further below):
footer{
font-family: 'Open Sans', sans-serif;
margin-top:200px;
border-top:6px solid rgba(246, 246, 246, 0.8);
background-repeat:repeat-x;
background-position:left bottom;
background-size:contain;
background-color:#b8b8b8;
}
.footer-column-container{
width:95%;
max-width:1200px;
list-style-type:none;
margin:0 auto;
padding:25px 0;
}
.footer-column-container li{
float:left;
padding:20px 5px;
width:25%;
box-sizing:border-box;
}
.footer-column-container ul {
list-style-type:none;
}
.footer-links{
height:250px;
}
.footer-links li{
float:none;
display:block;
line-height:12px;
padding:8px 0;
width:100%;
}
.footer-column h4{
color:#fff;
font-size:16px;
font-weight:bold;
margin-bottom:10px;
}
.footer-column a:link{
font-size:14px;
text-decoration:none;
color:#fff;
}
#bottom-bar-container{
background-color:#000;
border-top:1px solid #393939;
padding:20px 0;
}
#bottom-bar{
font-size:12px;
margin:0 auto;
width:95%;
text-align:center;
color:#fff;
}
There's a fair bit of code so, rather than place it all here, I'll list links to CodePens:
Link to working HTML/CSS: http://codepen.io/Ben10/pen/VjBgyB
Link to working HTML / Faulty CSS: http://codepen.io/Ben10/pen/pbkYAd
Many thanks if you can help me.
you have a floating issues so use clear:both; on #bottom-bar-container
#bottom-bar-container {
background-color: #000;
border-top: 1px solid #393939;
clear: both;
padding: 20px 0;
}
or
use overflow: hidden; to .footer-column-container
I hope that will be helpful to achieve you goal
Add below overflow:hidden; into your .footer-column-container
.footer-column-container{
width:95%;
max-width:1200px;
list-style-type:none;
margin:0 auto;
padding:25px 0;
overflow:hidden; /*Add this*/
}
Add the <div style="clear:both;"></div> before <div id="bottom-bar-container"></div>
Since you are using floating elements inside footer-column-container, its height won't be set automatically. You need to use overflow:hidden in .footer-column-container CSS.
That is
.footer-column-container{
width:95%;
overflow:hidden; /*This property is missing*/
max-width:1200px;
list-style-type:none;
margin:0 auto;
padding:25px 0;
}
So that the div will accommodate its floating child elements , ie the li elements inside footer-column-container.
You have overflow:hidden property set in your working CSS. In the faulty code, that property is missing. It is simply the reason why it has messed up.
Its only need to clear div. I check your whole code you need to clear your div. Here updated fiddle.
Here I change your code, Have look..
footer{
font-family: 'Open Sans', sans-serif;
margin-top:200px;
border-top:6px solid rgba(246, 246, 246, 0.8);
background-repeat:repeat-x;
background-position:left bottom;
background-size:contain;
background-color:#b8b8b8;
width:100%;
float:left;
clear:both;
}
.footer-column-container{
width:95%;
max-width:1200px;
list-style-type:none;
margin:0 auto;
padding:25px 0;
display:inline-block
}
For more details for clearing div why and how please go here.
learnlayout.com
quirksmode.org
css-tricks.com
I hope it will help you :)

How can I make the whole page stay where it is?

I would like to get a horizontal scroll bar involved when my page hits its breaking point and elements start to escape their divs. I set my header as an inline background image but... well you know, it stays where it is of course and moves out side the div. there is no response when the window gets too small. Help!
#logo {
background-repeat:no-repeat;
background-position: top center;
background-size: 100%;
}
#mainnavi {
border-top:inset gold 3px;
background-color:#000033;
border-bottom:inset gold 3px;
height:45px; text-align:center;
font-size:13px;
width:100%;
text-shadow:20%;
}
a:link,a:visited {
font-weight:bold;
display:inline-block;
color:#FFFFFF;
background-color:#000033;
text-align:center;
height:30px;
width:120px;
text-decoration:blink;
overflow:hidden;
}
a:hover,a:active {
background-color:#000099;
}
that is what i have going on for the navigation and my logo.

Unable to click some hyperlinks due to css formatting

My final is to recreate a basic html page with my own css like csszengarden.com.
I made a simple one page deal at http://randallmiller.pcriot.com/72bclass/final72b/index.html.
However a few of my links are not clickable. Here is the css for the site. Any help would be greatly appreciated!
EDIT: I fixed the unclickable part with z-index:1, I think because of the padding on linkblock2. However, now my a:hover to turn them grey is only working for a few.
html{
height:100%;
}
body{
background:#000000;
}
h3{
margin-top:0;
}
h3 span{
color:white;
display:block;
}
.pgtitle1{
word-spacing:10px;
padding-top:25px;
margin-left:125px;
font:1.5em "Trebuchet MS", Arial, Helvetica, sans-serif;
}
.pgtitle2{
padding-top:10px;
margin-left:275px;
font:bold .7em "Comic Sans MS", cursive;
letter-spacing:2px;
}
div#linkblock1{
position:absolute;
top:200px;
padding-left:25%;
}
div#linkblock2{
position:absolute;
top:200px;
padding-left:67.5%;
}
div a{
border-bottom:solid 1px white;
text-decoration:none;
text-align:center;
padding:5px;
display:block;
width:90px;
}
div a:hover{
color:rgb(200,200,200);
}
div a:visited{
color:blue;
}
div#fg_img{
height:323px;
background:url(bg.jpg) no-repeat center;
margin-top:50px;
line-height:999;
overflow:hidden;
}
h2{
font-size:.75em;
color:#FFF;
position:absolute;
top:10px;
left:60px;
}
You've covered up some of your links with #fg_img. Set some z-indexes.
Your divs are overlapping each other in many weird ways, the position:absolute on the div with the right links "linkblock2" is overlapping the links on the left.
You should really remove the position:absolute and use float on the divs, and you wouldn't run into that problem.
Not sure if it's an option or not, but check out a CSS Grid system if you can use it on your assignment.

div tag doesnt display properly in browsers. what am i doing wrong? i know browsers render differntly but what is the solution to this?

CSS stylesheet
div.Header
{
background-color:#999999;
text-transform:capitalize;
text-align:center;
}
div.leftdiv
{
float:left;
height:200px;
width:15%;
position:fixed;
background-color:#FFFF66;
text-transform:uppercase;
text-align:justify;
}
div.rightdiv
{ margin-left:15px;
margin-top:25px;
float:left;
position:fixed;
background-color:#FFFF99;
width:50%
height:200px;
left: 438px;
top: 39px;
}
div.footer
{
clear:both;
margin-left:20px;
margin-top:20px;
margin-right:20px;
margin-right:20px;
padding-bottom:10px;
padding-left:10px;
padding-right:10px;
padding-right:10px;
border-color:#000066
border:thick;
text-align:center;
background-color:#FFCCFF;
}
Upon further review, it looks like you have some fixed position attributes that are tripping you up. If you remove them, everything displays fine:
http://jsbin.com/emona3/3/edit
put float:left for footer its essential to move footer after all other div .

Html scroll bar problem

I'm designing a fairly simple web site but as I don't have much experience I have a very simple question.
I've done the layout in a way that displays all the necessary information without the need of scrolling down. But for some reason it's there.
The site's css is as following:
#charset "utf-8";
/* CSS Document */
html {height:100%;width:100%; margin:0;}
body{
height:65%;
font-size:100%;
font-family:Calibri;
background-image:url(/images/gradient.png);
background-repeat:repeat-x;
background-color:#FFF0;
color:#00080;
margin-left:15%;
margin-top:3%;
margin-right:15%;
width:65%;
}
#banner {
height:40%;
background: url(/images/banner.jpg) right scroll no-repeat;
}
#left_container{
width:20%;
height:80%;
}
#left_container img{
width:100%;
}
a{
text-decoration:none;
color:#FFF;
border:none;
}
#menu{
width:100%;
height:85%;
font-size:120%;
}
#menu td{
background:#999;
color:#FFF;
padding:4%;
}
#menu tr td a:hover{
background:#CCC;
color:#333;
}
#right_container{
width:75%;
height:auto;
position:relative;
left:+26%;
top:-80%;
}
#right_container h2{
font-size:300%;
}
#right_container h3{
font-size:200%;
}
But the web site looks like this (and the scroll appears when I set the right_container h2 title (home) size in the css bigger than 190%....but I need it to be as I set...or it will be to small).How can I remove the scroll bar?
image -> http://i29.tinypic.com/hx3uy8.jpg
You can control the appearance of scrollbars in CSS by using the Overflow property. So you could try adding overflow: hidden to your BODY CSS declaration and see if that helps.