Few spans are going crazy - css

I have few spans on my website , and i'm trying to make them go on the place I want them to , but it isn't going well as of now .
My HTML code:
<span class="forumname">מה שבראש</span><br />
<span class="forumname">מה שבלב</span><br />
<span class="forumname">תמונות הגולשים</span><br />
<span class="forumname">סקרים</span><br />
<span class="forumname">אקטואליה</span><br />
<span class="forumname">יהדות ותורה</span><br />
<span class="forumname">אתאיזם</span><br />
<span class="forumname">צבא וביטחון</span><br />
forumname Class in CSS :
.forumname {
color: black;
text-decoration: none;
font-family: Arial;
font-size: 14px;
position: relative;
top: 77px;
left: 720px;
font-weight: bold;
margin-top: 80px; }
And this is the result :
How can I align all of the spans so they can all start from the same position on the right ? Please Help me , i've tried everything , and i'm going crazy !
I tryed adding direction: rtl; to the span class, float: right and left; but with no success .
Thank you in advance ,
Iliya Vaitzman .

Just set text text-align: right on the parent element - DEMO

That really needs to be a list, spans is just the absolute wrong way to do it...
http://jsfiddle.net/calder12/xUSdv/1/
<ul>
<li>מה שבראש</li>
<li>מה שבלב</li>
<li>תמונות הגולשים</li>
<li>סקרים</li>
<li>אקטואליה</li>
<li>יהדות ותורה</li>
<li>אתאיזם</li>
<li>צבא וביטחון</li>
</ul>
li a{
color: black;
font-family: Arial;
font-size: 14px;
position: relative;
font-weight: bold;
margin-top: 80px;}
li{ list-style-type:disc;
margin-right:100px;}
ul{
text-align:right;}

Related

Bootstrap smaller input and smaller input-group-addon issue

I have used this in my CSS to create an smaller input field:
.input-xs {
height: 22px;
padding: 2px 5px;
font-size: 12px;
line-height: 1.5; /* If Placeholder of the input is moved up, rem/modify this. */
border-radius: 3px;
}
But of course I need to adjust the input-group-addon as well or it will look like this.
To prevent this and make the input-group-addon smaller, I have added this to my CSS.
.input-group-xs > .form-control,
.input-group-xs > .input-group-addon,
.input-group-xs > .input-group-btn > .btn {
height: 22px;
padding: 2px 5px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
But it looks like this now.
Any suggestions to get it aligned again?
Complete code
<div class="input-group-xs form-group" id="div_exp_aantal['.$i.']">
<input type="number" min="0" class="form-control input-xs" id="exp_aantal['.$i.']" name="exp_aantal" placeholder="Huidige aantal" value="'.$row_list['aantal_huidig'].'" onkeyup="validate_exp(this, '.$i.')" onmousemove="validate_exp(this, '.$i.')">
<span class="input-group-addon">stuk</span>
</div>
If I were you, I'd add the class name "input-group" before the "input-group-xs" in order to add the base css.
.input-group {
position: relative;
display: table;
border-collapse: separate;
}
So your code should look like this:
<div class="input-group input-group-xs form-group" id="div_exp_aantal['.$i.']">
<input type="number" min="0" class="form-control input-xs" id="exp_aantal['.$i.']" name="exp_aantal" placeholder="Huidige aantal" value="'.$row_list['aantal_huidig'].'" onkeyup="validate_exp(this, '.$i.')" onmousemove="validate_exp(this, '.$i.')">
<span class="input-group-addon">stuk</span>
</div>

Top vertical align text.

Having trouble vertical top-aligning two simple text. For some reason there is a small gap ... tried padding, line-height etc, nothing. Any input helpful.
<span style="padding:0px;font-size: 48px;font-style: italic;font-weight: bold;"><span style="padding:0px;font-size: 30px;font-style: italic;vertical-align:text-top;">VITA</span>
VITA
https://jsfiddle.net/p64g800g/
Many thanks
You could change the line height on the second. I would wrap them in a div rather than another span, but didn't do that here since it may not be an option to you.
.span1 {
padding: 0px;
font-size: 48px;
font-style: italic;
font-weight: bold;
}
.span2 {
font-size: 30px;
font-style: italic;
vertical-align: text-top;
}
.span3 {
font-size: 40px;
line-height: 39px;
font-style: italic;
vertical-align: text-top;
}
<span class="span1">
<span class="span2">VITA</span>
<span class="span3">VITA</span>
</span>
Use font-size: 0px; for the parent so that the space between the span has a width of 0px.
Use this:
<div style="font-size: 0px;">
<span style="font-size: 30px;font-style: italic;vertical-align:text-top;">VITA</span>
<span style="font-size: 40px;font-style: italic;vertical-align:text-top;">VITA</span>
</div>
Alternative: Float the <span>
span {
float: left;
}
<span style="font-size: 30px;font-style: italic;">VITA</span>
<span style="font-size: 40px;font-style: italic;">VITA</span>
A you can see, your <span> tags can't accept margin-top, margin-bottom, padding-top and padding-bottom. This is where you should start thinking about display property.
The display you need here is inline-block. With this property you can start moving your <span> elements vertically.
<span style="padding: 0px;font-size: 48px;font-style: italic;font-weight: bold;">
<span style="font-size: 30px;font-style: italic;vertical-align: text-top;display: inline-block">VITA</span>
<span style="font-size: 40px;font-style: italic;vertical-align: text-top;display: inline-block;margin-top: -4px">VITA</span>
</span>

Child Div not showing border

I have a webpage with two nested divs.
I need the inside div to show its border, however it is not. I have tryed every suggestion I have come across, but no avail.
while trying different solutions, I have noticed that the parent div does show its border without much hassle. What am I doing wrong?
css
.contentItemsWrapper
{
margin:auto;
width: 900px ;
margin-left: auto ;
margin-right: auto ;
text-align:center;
padding-top:20px;
padding-bottom:20px;
border:solid red;
border-width:5px 0;
/*this div's border is showing up fine.*/
}
.contentEventItem {
font-family: Georgia, "Times New Roman", Times, serif;
font-style: normal;
font-weight: normal;
position: relative;
border:solid red;
border-width:5px 0;
/* this last one is not working*/
}
HTLM:
<div class="contentItemsWrapper">
<div class="contentEventItem style=" border:solid="" red;="" border-width:5px="" 0;="" "="" id="evento1">
<div class="DataIncontro" id="dataIncontro1">
<span class="month">Decembre</span>
<span class="number">26</span>
<span class="time">15:00</span>
<span class="day">Gio</span>
</div>
<div class="logoSquadra"><span class="helper"></span><img name="" src="images/logo_nbb.png" alt="" style="background-color: #003399"></div>
<div class="nameEventLocation" id="nameEventLocation1">
<strong class="eventname">New Basket Brindisi - Cremonese</strong>
<span class="location">Nome Stadio</span>
</div>
<div class="logoSquadra"><img name="" src="images/logo_nbb.png" alt="" style="background-color: #003399"></div>
<div class="noteEvento">Aquistabili online fino al xx dicemnre, ore 20.00</div>
<div class="buttonDiv">
<p>
<a class="multi-line-button green" href="#" style="width:14em">
<span class="title">Compra Ora!</span>
<span class="subtitle">30-days free!</span>
</a>
</p>
</div>
</div>
</div>
What am I doing wrong? Can somebody please help me?
Thank you very much in advance for your time.
Im confused, you want this?
CSS:
.contentEventItem {
font-family: Georgia, "Times New Roman", Times, serif;
font-style: normal;
font-weight: normal;
position: relative;
border: 1px solid #000;
/* this last one is now working*/
}
All I have done is add border: 1px solid #000; and deleted this odd HTML:
border:solid="" red;="" border-width:5px="" 0;="" "=""
DEMO HERE
border-width:5px 0;
There is no shorthand for more than one border position. Try this instead.
border-bottom: 5px solid red;
border-top: 5px solid red;
border-left:none;
border-right:none;

Applying CSS (via LESS) to modal box by ID does not work

I'm a new user to StackOverflow. Looking forward to be part of your wonderful community. My question is as follows:
I want to use a Twitter Bootstrap modal box on my website. However, I'm facing problems getting the CSS to work on the modal box. I wrote the following HTML code:
<div id="playModal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<span class="login"><strong>Login</strong></span>
</div>
<div class="modal-body">
<form class="form-horizontal" accept-charset="utf-8" method="post" action="#">
<fieldset>
<div class="control-group">
<label class="control-label" for="play_form_username">Username</label>
<div class="controls">
<input type="text" id="play_form_username" name="username" placeholder="Enter your username" required />
</div>
</div>
<div class="control-group">
<label class="control-label" for="play_form_password">Password</label>
<div class="controls">
<input type="password" id="play_form_password" name="password" placeholder="Enter your password" required />
</div>
</div>
</fieldset>
<span>Forgot your password?</span>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Play!</button>
</div>
</form>
</div>
<div class="modal-footer">
<span>Not a member yet? Join Now!</span>
<!--need to find a way to get this modal box to disappear if registerModal is called-->
</div>
</div>
Next, I want to configure the design of the page. I am using LESS to write code which is converted to CSS through SIMPLESS. I tried passing my desired CSS configuration through the modal div ID in the following LESS code:
#playModal{
width: 300px;
.modal-backdrop,
.modal-backdrop.fade.in{
opacity: 1;
filter: alpha(opacity=100);
}
.modal-header{
.login{
font-family: arial;
font-size: 60px;
font-weight: bolder;
}
}
.modal-body{
max-height: 200px;
}
}
This compiles successfully to CSS, but when I analyse the webpage using Firebug, it appears that none of the CSS has been passed for the modal box. Instead, if I use pass the CSS configurations by class, similar to the following, it works.
.modal{
width: 315px;
margin-left: 0px;
left: 50%;
top: 58px;
.modal-header{
padding: 7px 15px;
.login{
color: #203665;
font-size: 20px;
font-weight: bolder;
line-height: 24px;
}
}
}
Why is it that the CSS rules are not passed when referring to the modal box by ID? Isn't ID be more specific than class? Note: even when i use !important on the code using ID, it doesn't work.
It will be greatly appreciated if someone can help me out- though it's probably because I did something stupid. (The context why I need to use ID and not just class is: I'm needing to add a second modal box, and I want it to have different size, field sizes etc.) Thanks.
EDIT: (Answers my own silly question)
After dabbling around with the code, I found that the following works:
//Settings for all models
.modal-backdrop.fade.in{
opacity: 0.9!important;
filter: alpha(opacity=90)!important;
}
//Settings for playModal
#playModal{
width: 315px;
margin-left: 0px;
left: 50%;
top: 58px;
.modal-header{
padding: 7px 15px;
.login{
color: #203665;
font-size: 20px;
font-weight: bolder;
line-height: 24px;
}
}
.modal-body{
padding: 10px;
.control-group{
margin-bottom: 10px;
.control-label{
width: 65px;
text-align: left;
}
.controls{
margin-left: 75px;
}
}
span a{
display: block;
margin-top: 0px;
padding-top: 15px;
float: left;
&:hover{
text-decoration: none;
}
}
.form-actions{
display: block;
float: right;
margin: 0px;
padding: 0px;
border: 0px;
background-color: #FFFFFF;
.btn{
font-size: 18px;
line-height: 24px;
}
}
}
.modal-footer{
padding: 7px!important;
}
}
I think what I did wrong was to put the .modal-backdrop.fade.in inside the #playModal, it dawns on me now that .modal-backdrop.fade-in would be referring to the area outside of the #playModal div.
So all in all it was just a trivial mistake that got me worked up for so many hours. Sorry to waste everyone's time. What a way to start on StackOverflow. But anyway thanks everyone for trying to help me out. Please vote to close this post.
You're using the wrong case.
You give the element the id, playModal
Your css refers to #playmodal
Css is case-sensitive.

CSS <h> Margin help?

I have a margin used to space some headings down away from an image, but despite this method working on other pages, it does not in this instance.
I know there are plenty of alternative solutions, but am curious as to what is wrong with this one. Can anyone help?
<div class="column" style="width: 237px">
<img src="img.jpg" alt="" title="img" width="237" height="300" class="alignnone size-full wp-image-84" />
<h1 style="margin-top: 40px">VAL</h1>
<span class="detailhead">Heading 1</span> <span class="detail">Detail 1</span><br />
<span class="detailhead">Heading 2</span> <span class="detail">Detail 2</span>
</div>
These are all the additional class declarations:
The image class has no associated style (class was inserted by Wordpress).
h1 {
font-size: 17px;
}
span.detailhead{
font-size: 13px;
color:#000000;
}
span.detail {
position: relative;
top: 1.5px;
font-size: 14px;
color:#000000;
}
.column {
display: block;
float: left;
}
Here is the offending style i overlooked:
img {
display: block;
float:left;
margin-right:10px;
margin-bottom:10px;
border-style: solid;
border-width: 1px;
border-color: #ffffff;
z-index: 2;
}
A more specific selector fixed the issue.
Thanks to all for helping me with this seriously schoolboy error!
Could you try adding a style="display:block" to the img tag?
If your using chrome or safari for testing: use the element inspector to check wether your inline setting is not overruled by an !important; declaration in one of the classes.
Edit: To quickly test this you can also add " !important;" to your inline css.

Resources