I'm totally lost, I just finished setting up my navigation bar and now i can't seem to show the settings icon and the main text in any other position than fixed... here is my code sample , it can't show images
This is the entire relevant code, the html, as well as the css.
The end result should be a navigationbar, similar to the one that facebook uses for "Groups".
HTML(php):
<div style='width:100%;max-height:31px;position:relative;top:1px;overflow:hidden;'>
<div style='width:2000px;max-height:31px;position:relative;overflow:hidden;'>
<div class='groups_navi-active' id='navbar-groupname'>
<div style='height:30px;float:left; width:11px;'>
</div>
<div style='height:30px;float:left;'>
".$navbar_groupname."
</div>
<div style='height:30px;float:left;width:11px;'>
</div>
</div>
<div class='groups_navi-inactive' id='navbar-structure'>
<div style='height:30px;float:left; width:11px;'>
</div>
<div style='height:30px;float:left;'>
Structure
</div>
<div style='height:30px;float:left;width:11px;'>
</div>
</div>
<div class='groups_navi-inactive' id='navbar-explore'>
<div style='height:30px;float:left; width:11px;'>
</div>
<div style='height:30px;float:left;'>
Explore!
</div>
<div style='height:30px;float:left;width:11px;'>
</div>
</div>
<div class='groups_navi-right'>
</div>
</div>
<div style='float:right;position:fixed;top:42px;height:22px;width:796px;z-index:1'>
<div class='groups_navi-settingsicon' id='groups_navi-settingsicon' ></div>
<div style='clear:both;'></div>
<!-- THIS IS HIDDEN AND WILL BE MADE VISIBLE WITH JAVASCRIPT !-->
<div id='navbar-settings-list' style='border-left:1px solid #787878;border-right:1px solid #787878;border-top:1px solid #787878;background-color:#ffffff;border-bottom:2px solid #283d6c;background color:#ffffff;float:right;display:none;z-index:5;'>
<div style='width:126px;height:4px;'></div>
<div class='groups-navi-settings-list_option-inactive' id='groups-navi-settings-list_option--deletegroup' title='".$_GET['groupid']."'>
Delete Group
</div>
<div style='width:126px;height:4px;'></div>
</div>
</div>
<div style='z-index:8;position:fixed;width:796px'>
<div>
<img src='IMG/texticon.png'>
</div>
<div>
".$groupoverview_groupdescription."
</div>
</div>
CSS:
.groups_navi-active
{
height:30px;position:relative;line-height:30px;
font-size:13px;
font-weight:bold;
color:#000000;
float:left;
z-index:2;
}
.groups_navi-inactive
{
float:left;
height:30px;
position:relative;
background-color:#f2f2f2;
border-bottom:1px solid #cccccc;
border-left:1px solid #dbdbdb;
border-right:0px;
border-top:0px;
line-height:30px;
font-size:11px;
font-weight:bold;
color:#818181;
z-index:2;
}
.groups_navi-right
{
float:left;
height:30px;
width:1000px;
position:relative;
background-color:#f2f2f2;
border-bottom:1px solid #cccccc;
border-left:1px solid #dbdbdb;
border-right:0px;
border-top:0px;
line-height:30px;
font-size:11px;
font-weight:bold;
color:#818181;
}
.groups_navi-settingsicon
{
width:31px;height:22px;background: url('../IMG/navbar-stgs.png');float:right;background-position: 0 0;
}
.groups_navi-settingsicon-active
{
width:31px;height:22px;background: url('../IMG/navbar-stgs.png');float:right;background-position: 0 -22;
}
.groups-navi-settings-list_option-inactive
{
width:126px; height: 18px;text-align:center;line-height:18px;
border-top:1px solid #ffffff;
border-bottom:1px solid #ffffff;
}
.groups-navi-settings-list_option-inactive:hover
{
width:126px; height: 18px;text-align:center;line-height:18px;background-color:#6c83b6;color:#f8ffff;
border-top:1px solid #39579b;
border-bottom:1px solid #39579b;
cursor:pointer;
}
The container (parent div) of your settings icon is position:fixed. That will override your float:right. In fact, I see two instances of using position:fixed without setting the X/Y offsets, which really just doesn't work.
If that's not it... I think you'll have better answers if you can boil your code down to the problematic areas.
I think you sould check the images path , its must be correct
I had made sample of it on this url
http://jsfiddle.net/563Vx/
feel free to update this fiddle
Related
I am trying to set three div tags to be in one line and get separated by some spaces and different underline colors. to make things easier, this is what I'm trying to do:
see posted in Tech and share and tweet. that's what I'm trying to do. I saw their source code, and tried to imitate. but failed. can you please help me?
<div class="source">
<h3>source</h3>
</div>
<div class="share">
<h3>share</h3>
</div>
<div class="share">
<h3>tweet</he>
</div>
Please remove inline style and add class in stylesheet:
<div style="float:left; border-bottom:2px solid #1D1D1B; width:48%; margin-right:2%">POSTED IN TECH
</div>
<div style="float:left; border-bottom:2px solid #FB473A; width:23%; margin-right:2%;">SHARE
</div>
<div style="float:left; border-bottom:2px solid #FB473A; width:23%; margin-right:2%;">TWEET
</div>
div
{
display:inline-block;
}
.source
{
border-bottom:1px solid #000;
}
.share
{
border-bottom:1px solid red;
}
<div class="source">
<h3>Lorem ipsum dolor sit amet, consectetur adipiscing</h3>
</div>
<div class="share">
<h3>share</h3>
</div>
<div class="share">
<h3>tweet</he>
</div>
Use display:flexbox; to center items in the same row, border-bottom to get the colored lines, and margin-right for spacing.
.source, .share{
font-family:sans-serif;
width:100%;
margin-right:5px;
}
.source a{
text-decoration:none;
color:black;
}
.source h3,.share h3{
margin-bottom:5px;
}
.share{
border-bottom:2px solid red;
}
.source{
border-bottom:2px solid gray;
}
.flex{
display:flex;
width:100%;
-webkit-justify-content: center;
justify-content: center;
}
<div class="flex">
<div class="source">
<h3>source</h3>
</div>
<div class="share">
<h3>share</h3>
</div>
<div class="share">
<h3>tweet</he>
</div>
</div>
In order to do what you have in your screen shot, Keep HTML whatever you already posted and write CSS for them as below. (Change color and width as you prefer)
.source {border-bottom:2px solid #000; width:48%; padding-bottom:10px; margin-right:2%}
.share {border-bottom:2px solid #d90000; width:23%; padding-bottom:10px; margin-right:2%}
.share:nth-child(2) {margin-right:0}
Regards
Manoj Soni
Here is my Html code for setting header and editable drop down
<div class="header" style="position:fixed; width:100%;">
<div class="container-fluid" id="continer1ForProjectContext">
<div class="row-fluid">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"><a>img style="margin-left:10%; margin-top:0.3%;" ></a>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="form-group has-success" style="margin-left:30%;">
<div class="select-editable" id="select2">
<select ng-options="item.label for item countryValues track by item.id" ng-model="selectedCountry">
<input type="text" name="Country" value="select" ng-model="selectedProject.label" id="txtProject" required />
</div>
</div>
</div>
</div>
and here is the CSS which i used
#continer1ForProjectContext{
background-color: #009530;
color: #959696;
height: 65px;
}
.select-editable {
background-color:white;
width:120px;
height:18px;
position:absolute;
}
.select-editable select {
top:0px;
left:0px;
font-size:14px;
border:solid #3c763d 1px;
width:170px;
margin:0;
height:30px;
border-radius: 5px 5px 5px 5px;
position:absolute;
}
.select-editable input {
bottom:0
width:150px;
padding:1px;
font-size:12px;
border:solid #3c763d 1px;
border-bottom:none;
height:29px;
border-radius: 5px 0px 0px 5px;
position:absolute;
}
.select-editable select:focus, .select-editable input:focus {
outline:none;
}
I want the header to be fixed which is done but at the same time when i scroll down the page the editable combo box is visible over the header. what is the problem??? any help is appriciable!!!
This 'problem' is caused because position: absolute; and position: fixed; take an element out of the document flow. To make sure your 'layers' of elements are in the correct order on the z-axis, you can use z-index.
A good read with a little more information is found here.
I want to create a photo gallery for one of my projets but I can't achieve it. What I want is something like that :
I don't know how many photo there will be but basically what it does is:
- Insert first photo in photo_div #1
- Insert 2nd in #2
- Goes to new line
- Insert 3rd in #3
- Insert 4th in #4
- Go to next column and first line
- Insert 5th in #5
- etc.
What I've made so far is the following code :
<div id="scroll_container">
<div id="photo_0" class="div_photo">
<!-- More content inside -->
</div>
</div>
And the CSS code :
scroll_container{
height:100%;
width:550px;
overflow-x:scroll;
overflow-y:hidden;
}
.div_photo{
float:left;
width:250px;
height:250px;
border:1px solid black;
margin:0 5px 5px 0;
position:relative;
display:inline-block;
}
But all I can achieve is a two columns gallery with 3 lines.
Could you help me to solve that ?
Thanks
Looks like your images are always of the same size, and that your problem is just the special order that you want.
In that case, this could be a solution:
.test {
width: 40px;
height: 40px;
border: solid 1px blue;
float: left;
margin: 2px;
}
.test:nth-child(4n+3)
{
border-color: red;
position: relative;
top: 44px;
left: -92px;
margin-right: -44px;
}
.test:nth-child(4n+4)
{
border-color: red;
position: relative;
top: 44px;
left: -46px;
margin-right: -44px;
}
fiddle
The idea is to float the first 2 elements, the 5 and 6, and so on. the 3rd and 4th (and 7th and 8th) are positioned relative to take them to the special positions
CSS
.div_photo{
float:left;
width:250px;
height:250px;
border:1px solid black;
margin:0 5px 5px 0;
position:relative;
display:inline-block;
}
.div_photo_1{
float:left;
width:250px;
height:250px;
border:1px solid black;
margin:0 5px 5px 0;
position:relative;
display:inline-block;
}
#scroll_container_1 {
height:auto;
width:257px;
display:inline-block;
}
#scroll_container {
height:auto;
width:514px;
}
#scroll_container_parent {
height:auto;
width:771px;
overflow-x:scroll;
overflow-y:hidden;
}
HTML
<div id="scroll_container_parent">
<div id="scroll_container">
<div id="photo_1" class="div_photo">1</div>
<div id="photo_2" class="div_photo">2</div>
<div id="photo_3" class="div_photo">3</div>
<div id="photo_4" class="div_photo">4</div>
<div id="photo_6" class="div_photo">6</div>
<div id="photo_7" class="div_photo">7</div>
<div id="photo_9" class="div_photo">9</div>
<div id="photo_10" class="div_photo">10</div>
</div>
<div id="scroll_container_1">
<div id="photo_5" class="div_photo_1">5</div>
<div id="photo_8" class="div_photo_1">8</div>
<div id="photo_11" class="div_photo_1">11</div>
</div>
</div>
Modified HTML...may be this should be good
This way you can write your html:
<div id="scroll_container">
<div id="photo_1" class="div_photo">
<!-- More content inside -->1
</div>
<div id="photo_2" class="div_photo">
<!-- More content inside -->2
</div> <div id="photo_3" class="div_photo">
<!-- More content inside -->3
</div> <div id="photo_4" class="div_photo">
<!-- More content inside -->4
</div> <div id="photo_5" class="div_photo">
<!-- More content inside -->5
</div>
</div>
For the 5th one you can apply additional css with id as :
#photo_5 {
display:inline-block;
margin-left:520px;
margin-top:-510px;
}
As you don't want to use table then you can achieve this with css.
Working Fiddle : jsFiddle Working Demo
im havin this error, in which my div doesnt expand
the line on top is the div, which is supposed to be surrounding the images and the text that you can see
heres the code:
html
<div class="team sizer">
<img class="teamtitle" src="FullWeb/v_landingpage/Title.png"/>
<div class="person1 pimage">
<img src="FullWeb/v_landingpage/Team_Pic_Base.png"/>
<p class="ptext">Person 1</p>
</div>
<div class="person2 pimage">
<img src="FullWeb/v_landingpage/Team_Pic_Base.png"/>
<p class="ptext">Person 2</p>
</div>
<div class="person3 pimage">
<img src="FullWeb/v_landingpage/Team_Pic_Base.png"/>
<p class="ptext">Person 3</p>
</div>
<div class="person4 pimage">
<img src="FullWeb/v_landingpage/Team_Pic_Base.png"/>
<p class="ptext">Person 4</p>
</div>
<p class="pagebottomtext" width="44.21052631578947%">Lorem ipsum</p
</div>
css:
.team{
position:relative;
margin-bottom:700px;
border: 1px solid black;
}
.teamtitle{
position:absolute;
top:1%;
left:47.15789473684211%;
width:5.684210526315789%;
height:42px;
border: 1px solid black;
}
.pimage{
position:absolute;
top:120px;
border: 1px solid black;
}
.person1{
left:530px;
}
.person2{
left:770px;
}
.person3{
left:1010px;
}
.person4{
left:1250px;
}
.ptext{
font-family: Lucida Sans Unicode;
color:#999999;
font-size:1.1em;
border: 1px solid black;
}
.pagebottomtext{
position:absolute;
text-align:center;
width:44.21052631578947%;
top:320px;
left:27.89473684210527%;
font-family: Lucida Sans Unicode;
color:#999999;
}
thanks in advance for your help.
http://jsfiddle.net/UPsew/3/
It's because all the child elements of the div have position: absolute, and hence are taken out of the flow (i.e. they don't take up any space within the containing div, and hence it shrinks to zero height).
You'll need to position them using something else. I had a little play and came up with this using margins to position:
http://jsfiddle.net/UPsew/7/
although you'll probably need to mess with the numbers.
Try adding overflow:hidden to the "team" class.
I'm not very sure that's the case, especially that your HTML isn't complete. If this doesn't work, please add your code on jsfiddle.
I'm having problems with this site I am building. I need a fixed width so that I can do margin-left and margin-right auto (center the form item on my 'left window'. Problem is that I'm trying to make this code modular so that it will work with any future forms I decide to create as well, meaning I need a variable height, depending on how many fields a form will need.
so to clarify the above statement, I'm trying to keep the fixed width and have a variable height (using min-height). The problem is that the background color and div border are not shrinking or expanding along with the div size. any ideas?
the site is here: http://traelid.com/news/createNews.php
here is my form code and my CSS code:
FORM:
<script type='text/javascript' src='../nicEdit/nicEdit.js'></script>
<script type='text/javascript'>
bkLib.onDomLoaded(function() {nicEditors.allTextAreas() });
</script>
<div class='frmcontainer'>
<div class='title'>TraeLid News</div>
<div class='fill'>
<div class='row'>
<div class='frm lbl'>
<label for='author'>Author:</label>
</div>
<div class='frm itm'>
Auto Author
</div>
</div>
<div class='row'>
<div class='frm lbl'>
<label for='subject'>Subject:</label>
</div>
<div class='frm itm'>
<input class='itm itmtxt' type='text' name='subject' />
</div>
</div>
<div class='row'>
<div class='frm lbl'>
<label for='content'>Content:</label>
</div>
<div class='frm itm txtarea' style='background-color:#fff;'>
<textarea class='itm itmtxtarea ckeditor' name='content'></textarea>
</div>
</div>
<div class='row'>
<div class='frm lbl'>
<label for='tags'>Tags:</label>
</div>
<div class='frm itm'>
<input class='itm itmtxt' type='text' name='tags' />
</div>
</div>
</div>
</div>
CSS:
.frmcontainer
{
text-align:center;
width:750px;
min-height:200px;
margin-left:auto;
margin-right:auto;
border-radius:10px;
border-width:1px;
border-style:solid;
}
.frm
{
margin:5px;
}
.title
{
clear:both;
width:750px;
margin-bottom:24px;
font-size:28px;
font-weight:bold;
text-decoration:underline;
font-variant:small-caps;
}
.row
{
width:750px;
height:auto;
float:left;
clear:both;
}
.lbl
{
font-size:18px;
font-weight:bold;
text-align:left;
height:30px;
width:150px;
float:left;
}
/*Container and input styles*/
.itm
{
text-align:left;
height:25px;
width:580px;
float:left;
}
.itmtxt
{
width:576px;
border-style:solid;
border-width:1px;
}
.txtarea
{
height:400px;
}
.itmtxtarea
{
width:578px;
height:343px;
border-style:solid;
border-width:1px;
}
.nicEdit-panel
{
background-color: #eee;
}
.nicEdit-selected
{
background-color: #fff;
word-wrap:break-word;;
overflow:hidden;
}
.nicEdit-main
{
word-wrap:break-word;
overflow:hidden;
max-height:343px;
}
on .frmcontainer add overflow: hidden;. fiddle ex