I need help with moving the profile-options div.
Here's an image so I can show you what I mean, the code is provided below the image.
Picture
index.html
<div id="page">
<div id="content">
<div id="info">
<div id="profile" name="picture">
<img src="https://scontent-frt3-1.xx.fbcdn.net/v/t1.0-9/17021559_243918039403378_4935600322061460678_n.jpg?oh=aa472121820d78b6116c91d47557bce6&oe=59738E5C" name="profile" />
<img src="https://scontent-frt3-1.xx.fbcdn.net/v/t1.0-9/17098689_244217759373406_3036940291705168436_n.jpg?oh=5f7b2ead37fdec3c2b13fa60fe431a0c&oe=5924FEA8" name="frontpage" />
</div>
<div id="menu" name="profile-name">
Random Guy
</div>
<div id="menu" name="profile-options">
Hi
</div>
<div id="personal">
<ul>
<!-- fields about the user profile -->
<li>Password: *****************************</li>
<li>Country: Bosnia & Herzegovina</li>
<li>City: not choosen</li>
<li>Address: not choosen</li>
<li>Phone number: not choosen</li>
</ul>
</div>
</div>
</div>
</div>
style.css
#page #content #info #profile[name="picture"]
{
width:700px;
}
#page #content #info #profile[name="picture"] img[name="profile"]
{
width:128px;
height:128px;
}
#page #content #info #profile[name="picture"] img[name="frontpage"]
{
width:572px;
height:128px;
margin-left:-4px;
}
#page #content #info #personal
{
width:698px;
}
#page #content #info #menu[name="profile-name"]
{
background-color:#d8d8d8;
width:116px;
height:48px;
max-width:116px;
max-height:48px;
border:0px;
padding:6px;
word-wrap:break-word;
margin-top:-5px;
}
#page #content #info #menu[name="profile-options"]
{
background-color:#d8d8d8;
width:572px;
height:48px;
border:0px;
margin-top:-5px;
}
How can I achieve this without using any position commands or margin, I tried left:0px and top:0px but did not work.
Try adding the float left property:
#page #content #info #menu[name="profile-name"]
{
background-color:#d8d8d8;
width:116px;
height:48px;
max-width:116px;
max-height:48px;
border:0px;
padding:6px;
word-wrap:break-word;
margin-top:-5px;
float: left;
}
#menu {
display: inline-block;
}
https://jsfiddle.net/zkmuxayq/
Just add 'float:left/right' to both of them and make sure their width sum is not larger than 100%.
.div {
position:relative;
float:left;
height:50px;
}
.left {
width:20%;
background-color:grey;
}
.right {
width:80%;
background-color:black;
}
<div class="div left"></div>
<div class="div right"></div>
You have some issues.
First of all, ids must be unique and you have 2 "menu" ids.
To achieve what you want, you have to set "display: inline-block" to the 2 divs.
You need to add a float left to profile-name. Currently if you inspect that element you can see it is taking up the full width of the screen.
#page #content #info #menu[name="profile-name"]
{
background-color:#d8d8d8;
width:116px;
height:48px;
max-width:116px;
max-height:48px;
border:0px;
padding:6px;
word-wrap:break-word;
margin-top:-5px;
float: left
}
Related
I have this problem, I can't seem to figure out how do I make this red DIV not past through the div on the right side, I want to make it stay between the right and the left div menu.
Website Screenshot
HTML Code:
<body>
<div class="navigationBar_default">
<div class="facetubeLogo_default"></div>
<div class="facetubeText_container_default"><center><strong class="facetubeText_default"></strong></center></div>
</div>
<div class="content_default">
<div class="leftMenu_onProfile">
<button class="leftMenu_buttonOnProfile"><img class="leftMenu_buttonImage" src="images/myProfileButton_onLeftMenu_onProfile.png" /><br>MY PROFILE</button>
<button class="leftMenu_buttonOnProfile"><img class="leftMenu_buttonImage" src="images/optionsButton_onLeftMenu_onProfile.png" /><br>GENERAL</button>
<button class="leftMenu_buttonOnProfile"><img class="leftMenu_buttonImage" src="images/generalButton_onLeftMenu_onProfile.png" /><br>OPTIONS</button>
<button class="leftMenu_buttonOnProfile"><img class="leftMenu_buttonImage" src="images/supportUsButton_onLeftMenu_onProfile.png" /><br>SUPPORT US</button>
<button class="leftMenu_buttonOnProfile"><img class="leftMenu_buttonImage" src="images/logOutButton_onLeftMenu_onProfile.png" /><br>LOG OUT</button>
</div>
<!-- there must be some stuff here, otherwise leftMenu_onProfile will glitch out. -->
<div class="contentCenter_onProfile">
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAA
</div>
<!-- there must be some stuff here, otherwise leftMenu_onProfile will glitch out. -->
<div class="rightMenu_onProfile">user1<br>user2<br>user3<br>user4<br>user5</div>
</div>
CSS Code:
.navigationBar_default {
background-color:#202020;
width:100%;
height:32px;
margin-left:-8px;
margin-right:-8px;
border:0;
top:0;
position:fixed;
}
.facetubeLogo_default {
background-image:url("../images/facetube_icon_30x30_png.png");
width:30px;
height:30px;
margin-top:1px;
margin-left:1px;
float:left;
}
.facetubeText_container_default {
margin-top:6px;
}
.content_default {
width:100%;
height:100%;
margin-top:32px;
margin-left:-8px;
margin-right:-8px;
margin-bottom:-8px;
}
.leftMenu_onProfile {
background-color:#0d0d0d;
margin-top:0px;
margin-left:-8px;
width:240px;
float:left;
}
.leftMenu_buttonOnProfile {
background-color:#0d0d0d;
border:0;
border-bottom:1px solid #ffffff;
width:240px;
height:48px;
color:#ffffff;
}
.leftMenu_buttonImage {
float:left;
margin-top:-2px;
margin-right:-6px;
}
.contentCenter_onProfile {
background-color:red;
padding:2px; /* padding is originally removed */
margin:0px;
top:0px;
}
.rightMenu_onProfile {
background-color:#0d0d0d;
margin-top:-20px;
margin-right:-16px;
width:300px;
color:#ffffff;
float:right;
}
I have feeling it has to do something with content_default and the width:100% but I don't know. I tried everything and I couldn't figure it out.
:/
Try this:
.contentCenter_onProfile {
background-color:red;
padding:2px; /* padding is originally removed */
margin:0 300px;
top:0px;
width: 50%; /* SET THIS */
white-space: pre-wrap;
word-break: break-all;
}
By setting the width, you can ensure the div does not overlap the right hand side div.
Setting float: left or float: right causes the elements to overlap.
I am trying to make a alert for my project which looks good but when I make it a mobile page the text goes under the icon. I want it to stay aligned beside the icon.
HTML:
<div class="rds-alert">
<img class="rds-alert-icon"/>
<div class="rds-alert-message">
<span class="rds-alert-so">Congratulation</span> Your submission has been approved.
</div>
</div>
CSS:
.rds-alert-so{
font-size:30px;
}
.rds-alert-icon{
width:70px;
height:70px;
vertical-align:middle;
margin-right:12px;
}
.rds-alert-message{
display:inline;
}
Jsfiddle: http://jsfiddle.net/0f2rpvc8/
Here's one way:
.rds-alert-so {
font-size:30px;
}
.rds-alert-icon {
width:70px;
height:70px;
margin-right:12px;
display:table-cell;
}
.rds-alert-message {
display:table-cell;
vertical-align:middle;
}
.rds-alert {
display:table-row;
}
<div class="rds-alert">
<img class="rds-alert-icon" />
<div class="rds-alert-message"> <span class="rds-alert-so">Congratulation</span> Your submission has been approved.</div>
</div>
or
.rds-alert-icon {
float: left;
}
http://jsfiddle.net/2Lfkrxup/
I am working for this company that has hired me to turn a new home page design of theirs into html and css. In the design they gave me there is a search box in the header that they would like to be same as the one on their current webpage (http://shop.manorfinewares.com/intro.html). I am unsure how to navigate their current page's source code in order to successfully transfer the search box to the new page I am designing for them. Here is the header code that I have so far...
CSS:
#header{
position:absolute;
width:100%;
top:0;
height:107px;
min-width:600px;
border-bottom: 1px dotted #86beca;
}
#headerContainer{
position:relative;
width:100%;
margin:0 auto;
top:0;
height:107px;
max-width:1280px;
min-width:600px;
border-bottom: 1px dotted #86beca;
}
.headerUtilityContainer{
float:left;
padding-top:4px;
margin-left:8%;
width:22%;
height:103px;
}
.headerUtilityContainer img{
float:left;
margin-top:2px;
width:40%;
height:9px;
}
.headerLogoContainer{
float:left;
margin:0px;
width:40%;
height:107px;
}
.headerLogoContainer img {
display:block;
margin-top:30px;
margin-left:auto;
margin-right:auto;
width: 55%;
max-width:250px;
height: 57%;
}
.searchContainer{
float:left;
text-align:right;
font-size:70%;
padding-top:4px;
margin-right:8%;
width:22%;
height:103px;
}
.headerBorderDiv{
float:left;
width:100%;
margin:0 auto;
padding:0px;
height:2px;
border-bottom: 1px dotted #86beca;
HTML:
<div id="header">
<div id="headerContainer">
<div class="headerUtilityContainer">
<img src="images/manorSocialButtons.png" />
</div>
<div class="headerLogoContainer">
<img src="images/homePageLogo.png"/>
</div>
<div class="searchContainer">
LOGIN / REGISTER CART (0)
</div>
</div>
</div>
ANY advice will be very helpful as I am not sure where to start. I have never worked with XLS search bars in the past
It's still unclear as to what exactly you want, a right floated search bar with clear icon on input? I have created this fiddle for you, it replicates the behaviour of site you mentioned.
http://jsfiddle.net/DP22Y/
HTML
<div id="container">
<div id="utility">Utility</div><!--
--><div id="logo">Logo</div><!--
--><div id="search">LOGIN / REGISTER | CART (0)
<span class="clearable">
<input class="data_field" type="text" name="search" placeholder="Search..."/>
<span class="icon_clear">x</span>
</span>
</div>
</div>
CSS
#container{
margin:0 auto;
height:100px;
width:80%;
}
#utility, #logo, #search{
box-sizing: border-box;
color:#000;
height:100%;
float:left;
}
#utility{
background:#f1f1f1;
width:33.3%;
padding:10px;
}
#logo{
background:#e0e0e0;
width:33.3%;
padding:10px;
}
#search{
background:#e9e9e9;
width:33.3%;
padding:10px;
text-align:right
}
#search > #data_field{
margin:10px 0 10px;
padding:5px;
width:100px;
float:right;
}
span.icon_clear{
position:absolute;
right:10px;
top:0px;
display:none;
cursor:pointer;
font: bold 1em sans-serif;
color:#38468F;
}
span.icon_clear:hover{
color:#f52;
}
.clearable{
position:relative;
}
.data_field{
padding-right:17px; /* add space for the 'x' icon*/
width:100px;
}
jQuery
$(document).on('propertychange keyup input paste', 'input.data_field', function(){
var io = $(this).val().length ? 1 : 0 ;
$(this).next('.icon_clear').stop().fadeTo(300,io);
}).on('click', '.icon_clear', function() {
$(this).delay(300).fadeTo(300,0).prev('input').val('');
});
As far as the functionality is concerned, that is a different question altogether. That depends on what language you are using, do you want to make the results appear on page reload or without that using ajax, whats the db scheme etc. But the basic search would be something like this
Wrap search field with a form
Set an action and method for the form
Action will be the page the search results will be shown on
I have some difficulties working with some CSS/HTML properties. I'm using bootstrap to have good rendering.
So I would like to have this :
The img is perfect but the problem is in the date (02.03.2013). I have put a float left on the img so the h3 works perfectly but not the date.
Could you help me please ? Here is what i have : http://jsbin.com/uqadoc/1/edit
Place a div around the <h3> and the <p> ( your date )
Have the H3 with a fixed width, and a Float:left;
and the p, float:right;
note : ive gone for a non div apreach in the jf but same concept
<div class='main'>
<img src='' class='ims'>
<div class='content'>
<h3 class="qwe" >serwqerqwrewqr</h3>
<p class="wer">dafdf</p>
<div class="rty" >
sfdg
ffffffffffffffffffffff
fdsffffffffffff</br>
sfdg
ffffffffffffffffffffff
fdsffffffffffff</br> sfdg
ffffffffffffffffffffff
fdsffffffffffff</br> sfdg
ffffffffffffffffffffff
fdsffffffffffff</br>
</div>
</div>
</div>
.main{
width:500px;
height:200px;
background:black;
}
.content{
width:100ps;
height:200px;
background:red;
}
.ims{
float:left;
width:100px;
height:200px;
background:blue;
}
.qwe{
float:left;
width:300px
height:50px;
}
.wer{
width:200px
height:50px;
float:right;
}
.rty{
padding-top:80px;
width:400px
float:right;
}
Jfiddle
http://jsfiddle.net/qAEzr/
I just wanted to create a newsbox just by using CSS without so many IMG or TABLE crap. It works quite well but there will always appear a space between my image and the colored bar under the picture which should be directly under the picture not with some space between. Here is my code :
<div id="mainbody">
<div class="news_box">
<div class="news_box_inside">
<img src="img/newsbox1.jpg" width="270" height="140" border="0" />
<div class="news_box_bar"></div>
</div>
</div>
</div>
#mainbody {
margin: 0 auto;
width: 900px;
padding-top:30px;
padding-bottom:30px;
}
.news_box {
float:left;
width:288px;
height:348px;
background-color:#DDDDDD;
margin-right:5px;
margin-left:5px;
border:1px;
border-style:solid;
border-color:#BBBBBB;
}
.news_box_inside {
float:left;
margin:9px;
width:270px;
height:330px;
background-color:#FCFCFC;
}
.news_box_bar {
background-color:#540000;
height:43px;
border:1px solid #892d2d;
}
I tried to set the margin and padding to zero for the image or trying position: or top: but somehow I can't get rid of the space. Anyone got a good solution ?
Best regards,
Kris
Add this to your CSS:
.news_box_inside > img {
display: block;
}
Example: http://jsfiddle.net/grc4/TV4zT/
Kris,
If you inspect <img> element by default it's css property display is set to inline-block, SO I suggest to apply style on <img> element and make it display:block
<img src="img/newsbox1.jpg" width="270" height="140" border="0" style="display:block" />
DEMO
Just add a margin to your newsbar as showm: DEMO
.news_box_bar {
background-color:#540000;
height:43px;
border:1px solid #892d2d;
margin-top:-5px;
}
.news_box_bar {
background-color:#540000;
margin-top:-5px;
height:43px;
border:1px solid #892d2d;
}
set this in your CSS class
use link below to see working solution for your problem
http://jsfiddle.net/v7NwR/
<div id="mainbody">
<div class="news_box">
<div class="news_box_inside">
<figure><img src="http://static.adzerk.net/Advertisers/a04d6b3e25c747f48ef794d13e765425.jpg" border="0" /></figure>
<div class="news_box_bar">sdfgsdfgsdfg</div>
</div>
</div>
</div>
css
.news_box{ float:left; border:5px #444 solid;}
figure{ font-size:0%;}
#mainbody{ color:#000;}
.news_box_bar{ background:red;}