PDA

View Full Version : سوال: بالا اوردن متن



mosi2007
جمعه 25 فروردین 1391, 18:05 عصر
سلام دوستان کارم خیلی گیره اگه امکانش هست سریعتر جواب بدید

ما در صفحه یه متنی داریم که اونو با حالا گزینه های مخلف میتونیم به چپ و راست بیاریم

چه روشی وجود دارد که با css متنو از خطی که روی ان است کمی به سمت بالا بیاریم ؟؟؟؟؟؟؟؟

hamid_shrk
جمعه 25 فروردین 1391, 18:14 عصر
درست منظورتون رو متوجه نشدم اما فکر میکنم با این کد :

padding-bottom:10px;

mosi2007
جمعه 25 فروردین 1391, 18:36 عصر
درست منظورتون رو متوجه نشدم اما فکر میکنم با این کد :

padding-bottom:10px;


نه مثله اینکه بد توضیح دادم
الان شما این متنو تو این تیبل مد نظر بگیرین که کجاست
میخام این متنو به سمت بالا بیارم 10 پیکسل


<!DOCTYPE html >
<head>
</head>
<body>

<table width="100%" border="1" height="500">
<tr>
<td id="c">this is test</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

</body>
</html>


بعدش که اومدم با css با vertical-align دست کاری کردم یهو متن نه به اندازه 10 پیکسل کلا رفت بالا چسبید


<!DOCTYPE html >
<head>
<style type="text/css">
#c{
vertical-align:10px;;

}
</style>
</head>
<body>

<table width="100%" border="1" height="500">
<tr>
<td id="c">this is test</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

</body>
</html>



با اون کدی هم که شما گفتید نشد

hamid_shrk
جمعه 25 فروردین 1391, 18:44 عصر
به این کد دقت کنید :


<!DOCTYPE html >
<head>
<style type="text/css">
#c
{
vertical-align:middle;
padding-bottom:30px;
}
#row
{
height:80px;
}
</style>
</head>
<body>
<table width="100%" border="1" height="500">
<tr id="row">
<td id="c">
this is test
</td>
<td>
salam
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td>
&nbsp;
</td>
</tr>
</table>
</body>
</html>

چنانچه شما به tr یک ارتفاع مشخص بدید اونوقت با padding-bottom دادن به هر کدوم از td ها میتونید متن اون رو بالا بیارید

mosi2007
جمعه 25 فروردین 1391, 19:18 عصر
مرسی از این که جواب میدن یه مشکله دیگه ای هم که دارم
اینه که این div رو مدنظر بگیرید توش یه مقداری متنه اگه متن ما زیاد بشه border پایین دیو پایین نمیاد وسر جاش میمونه میخوام با زیاد شدن متن border پایین هم ارتفاعش زیاد بشه
اگه دوباره منظورمو متوجه نشدید میتونید متن رو زیاد کنید تا ببیند چی میشه


<!DOCTYPE html >

<head>
<style type="text/css">
#container {
width: 900px;
height:40px;

margin-left: auto;
margin-right: auto;
background: #fdfdfd;
border: 1px solid #ccc;
padding:15px;
}
</style>
</head>

<body>
<div id="container">
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test

</div>
</body>
</html>

hamid_shrk
جمعه 25 فروردین 1391, 19:30 عصر
دوست عزیز کافیه تو css بجای
height:40px;
بنویسید :
height:auto;

mosi2007
جمعه 25 فروردین 1391, 20:06 عصر
دوست عزیز کافیه تو css بجای
height:40px;
بنویسید :
height:auto;
اره دستت درد نکنه
شرمنده
ببخشید سوالمو ناقص پرسیدم
فزض کنید ما 2 تا صفحه داریم یکی به اسم
a.php


<!DOCTYPE html >

<head>
<style type="text/css">
#container {
width: 900px;
height:auto;

margin-left: auto;
margin-right: auto;
background: #fdfdfd;
border: 1px solid #ccc;
padding:15px;
}
</style>
</head>

<body>
<div id="container">

</body>
</html>


که این صفحه میاد با دستور include در php فراخانی میشه در صفحه b.php
b.php


<!DOCTYPE html >

<head>
<style type="text/css">
#test
{
float:right;
}

</style>

</head>

<body>
<?php include("a.php"); ?>
<div id="test">
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test



</div>

</body>
</html>

بعد تو صفحه b.php یه div دیگه داریم که با css مقدار float را کذاشتیم right که حتما باید flaot=right باشد
الان شما اینو تست کنید دیگه ارتفا div اتوماتیک زیاد نمیشه موندم چیکار کنم ممنون اگه کمک کنید

cyrusthegreat
جمعه 25 فروردین 1391, 21:26 عصر
دوست عزیز

شما باید بعد از اون div با ای دی test و داخل همون container این تگ رو اضافه کنید:


<div style="clear: both"></div>


بعدم به نظر می رسه شما div container رو نبستید.

hamid_shrk
جمعه 25 فروردین 1391, 21:26 عصر
ببخشید من با php کار نمیکنم ولی هم میتونید clear:both کنید.
هم به div که کلاسش container هست overfollow:hidden بدید

mosi2007
جمعه 25 فروردین 1391, 23:06 عصر
ببخشید من با php کار نمیکنم ولی هم میتونید clear:both کنید.
هم به div که کلاسش container هست overfollow:hidden بدید
نشد


دوست عزیز

شما باید بعد از اون div با ای دی test و داخل همون container این تگ رو اضافه کنید:


<div style="clear: both"></div>


بعدم به نظر می رسه شما div container رو نبستید.
دوست عزیز اگه متوجه شده باشید میبینید که 2 تا صفحه داریم
اول اینکه اون تگی که فرمودید اضافه کنیم رو تو کدوم صفحه (a.php یا b.php)بعد از چه خطی وارد کنیم من که تو هر 2 تا صفحه بعد از 2 تا div قرار دادم و تست هم کردم ولی درست نشد اگه میشه دقیق تر توضیح بدین یا اینکه اون 2 تا صفحه رو بردارید و درست شده اش را بی زحمت تحویل بدید ممنون

cyrusthegreat
شنبه 26 فروردین 1391, 00:18 صبح
دوست عزیز

اینجوری می شه:
a.php:


<!DOCTYPE html >
<head>
<style type="text/css">
#container {
width: 900px;
height:auto;
margin-left: auto;
margin-right: auto;
background: #fdfdfd;
border: 1px solid #ccc;
padding:15px;
}
#test
{
float:right;
}
</style>
</head>
<body>
<div id="container">


b.php:



<?php include("a.php"); ?>
<div id="test">
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
this is e testthis is e testthis is e testthis is e test
</div>
<div style="clear: both"></div>
</div>
</body>
</html>